« first day (1466 days earlier)      last day (3482 days later) » 

3:00 PM
Ah - you're absolutely right. No problem with this: rubular.com/r/yWBYu2xhT4 @YourAdrenalineFix
 
user1994804
@CameronHurd Im lost...
 
user1994804
Could u elaborate?
 
user895378
@Fabien just to be clear, the error you're getting is caused by the following code?
 
user895378
$response = $client->request($uri)->wait();
$finalUri = $response->getRequest()->getUri();
 
user1994804
Im trying to grasp regex and im hung up all the way around
 
user1994804
3:02 PM
Could sure use some clarification
 
@YourAdrenalineFix } and ] only have relevance as special characters if they're preceded by their { and [ counterparts. Without them, they don't need to be escaped.
 
@rdlowrey $finalRedirectedUri = $response->getOriginalRequest()->getUri();
yesterday, by rdlowrey
// The LoD can shove it.
$finalRedirectedUri = $response->getOriginalRequest()->getUri();
 
user1994804
So why doesnt the examples include them?
 
user1994804
Maybe Im trying to overthink it?
 
@YourAdrenalineFix doesn't include what?
 
user895378
3:03 PM
@Fabien I'm sorry that example is dumb. That retrieves the original URI. It still shouldn't cause the memory error, though.
 
user1994804
] and }
 
@rdlowrey I thought the naming was odd.
 
@YourAdrenalineFix because they're not special.
 
user895378
$originalUri = $response->getOriginalRequest()->getUri();
$finalUri = $response->getRequest()->getUri();
 
user895378
^ that's what it should look like.
 
3:04 PM
Off you go, don't come back, thanks!
 
user1994804
well if you were to write [a-z vs [a-z] i betcha it wouldnt work
 
@YourAdrenalineFix I guess it's just not an exhaustive reference. They're not special characters unless they're preceded by their opening counterparts. I suppose they could be included with that caveat.
 
user1994804
nor would [a-z]{2,3
 
note that they don't recommend yubiko though
 
@YourAdrenalineFix because they're only special in those contexts. Perhaps the section could use some clarification, but they're not special on their own.
 
3:05 PM
@YourAdrenalineFix That's right, but a-z], or az} would.
 
user1994804
I must be trying to overthink it
 
user1994804
rolls eyes
 
@AndreaFaulds Hmm, filter_var + regex to reject whitespace, vs. regular expressions based on php.net/manual/en/language.types.float.php
 
3:08 PM
Cheers @rdlowrey. Not at a position to test quite yet but will let you know.
 
user895378
@Fabien It's fine, I'll make sure it's correct before pushing :)
 
@rdlowrey Yeah. One question though: Should it make writing private or merely protected?
 
user895378
@AndreaFaulds In a perfect world I would say private, but in PHP I feel like people would want protected ...
 
user895378
Although personally I would want private
 
@rdlowrey protected makes it more useful than private does
 
user895378
3:10 PM
It makes it easier. I don't know about more useful.
 
No, I mean, think of existing class hierarchies
For them, they may already be using protected
 
user895378
I just hate inheritance all around and think it's a bad way to write code.
 
@ircmaxell Sorry was "busy" :)
 
If we make readonly be private, it stops them from using this feature.
@TheodoreBrown Oh god no
FILTER_VALIDATE_FLOAT can't be that bad?
 
3:12 PM
@AndreaFaulds Yeah, github.com/theodorejb/PolyCast/blob/more-tests-2/lib/… is probably better
 
@webarto No I can't. Floating point numbers suck in general, except if you reading from an analogue device e.g. a non-digital volt-meter. Fixed point math all the things.
 
user895378
@AndreaFaulds Yeah, which is why as long as PHP has protected a readonly keyword would probably need to be writable to child instances.
 
user895378
even though I hate it :)
 
Unless we do something weird
public readonly private $foo
(ew)
 
user895378
that starts getting really verbose.
 
3:13 PM
Yeah.
Simple is better.
 
user895378
Wouldn't readonly replace the need for the initial public declaration there, though?
 
@ircmaxell What do you think? I'm sure you'd be opinionated on this
@rdlowrey True, but I don't want to allow omitting it
public readonly $foo is more explicit than readonly $foo
 
user895378
Hmm ... I kind of feel like readonly is mutually exclusive to public though.
 
user895378
I haven't given this a lot of thought, just stream of consciousness thoughts here.
 
readonly only makes sense as public
However, I'd prefer we keep the public keyword in front of it to avoid confusion
 
3:15 PM
can't we just implement properties?
 
user895378
well if you're going to still require the visibility keyword why not allow:
 
a la C#
 
user895378
public readonly $prop
protected readonly $prop
private readonly $prop
 
last one makes no sense
middle one might make sense
 
user895378
It would restrict writes to the private instance.
 
3:16 PM
@YourAdrenalineFix - have a look here: eloquentjavascript.net/09_regexp.html it's .js, but well written & the principals remain the same wherever you're using it.
 
Right
@rdlowrey To be honest I'd like to keep things simple to avoid confusion, though. public reaodnly $prop. No other options allowed, with protected and private being errors.
 
got a readonly patch ?
 
user895378
@AndreaFaulds This works for me. Simple is always best.
 
@JoeWatkins Gonna try and write one now. I don't think it, at its most basic, is too hard
 
cool ...
why is readonly only good for public properties ?
I wouldn't make that restriction ...
 
3:18 PM
Inheritance/interfaces shouldn't be too difficult: a subclass can make something non-readonly when it was readonly before, but not the reverse
@JoeWatkins I want to avoid confusion. We could always allow protected readonly later...
 
am I being voluntarily ignored because I said something stupid?
 
No
Properties might be a good idea...
 
user895378
@FlorianMargaine No, C# properties are a good model.
 
thanks, you scared me.
 
But I'd also like readonly.
 
3:19 PM
properties do give you readonly
 
Sure.
They do it in two possible ways though, both of which I don't like much.
 
@AndreaFaulds there's confusion, why not allow protected/private readonly properties
 
@JoeWatkins private readonly doesn't make sense... that's just a constant
But okay, maybe protected readonly
 
can we have constant objects ?
 
user895378
Also, wasn't the getters/setters RFC that got rejected similar to C# get{} accessors and set{} setters?
 
3:21 PM
@FlorianMargaine 1. $PublicProperty which has a getter that retrieves $_privateProperty. I don't like this much, why have two different properties?
@rdlowrey Yes, it did all the things
 
Morning @rdlowrey How 'bout that tagging 'eh?
 
2. Differing visibility accessors... which makes sense, kinda, but... I don't know =/
 
@AndreaFaulds I should say getters/setters then
 
user895378
@Danack Gotta fix an infinite loop bug first. Working on it.
 
cool.
 
3:22 PM
in my vocabulary, properties allow you to reach the fields
 
Yes, that's the getter/setter approach. Not a fan.
 
but you want the readonly :P
 
user895378
Yeah my main concern here is avoiding fcall altogether.
 
which is a single feature that getters/setters give
 
user895378
I want property access while knowing the object holder can't modify that property (without function calls)
 
3:24 PM
readonly won't protect you from a running event loop or something
 
if I take a reference to a property, I can change it ... there's no way to really circumvent modification completely ...
 
or you want immutables
eh, final properties.
 
@JoeWatkins You could block referencing readonly properties, though I'm hesitant to do that.
 
user895378
@FlorianMargaine I don't want it for that. I only want it for perf.
 
user895378
And because some things really are properties and it's stupid to require people to use a function to get at them with any safety.
 
3:25 PM
@AndreaFaulds how ?
 
I want it because I like plain properties but feel uneasy with letting anyone access them
getters are a workaround
 
user895378
@AndreaFaulds this.
 
@JoeWatkins Literally... prevent obtaining a reference.
 
yes, but how ?
 
They'd still be an overhead for checking whether the property is read-only....isn't it likely that marking a get method as final and getting opcache to inline that get function would be the only way to get a truly performant getter?
 
3:26 PM
I'm not sure that's possible, is what I'm trying to say ...
 
@JoeWatkins It is possible, retrieving a property to be referenced is different from a normal read
Internal classes already do this
 
user895378
(I don't know if it's possible, BTW, just that I hope it is)
 
ok good @AndreaFaulds
 
but wait
do you mean you want a readonly property... that's not readonly in the instance?
 
@webarto sorry to be a pita but kinda done everything I can without it now, can you just push and/or pastebin as it is?
 
3:27 PM
which classes do it, I wanna read that ?
 
@FlorianMargaine Precisely
 
only readonly for outside of the instance?
that's... a bad name imho :/
 
Within your class, you can write to it. Outside of it, you can't
 
oh ... that's strange ...
 
@JoeWatkins UString's ->length
 
3:28 PM
yeah
 
some extensions, can't remember any off the top of my head
 
@DaveRandom Yup, haven't forgot, it's just that work began as soon as I sat down. Will ping you in a bit.
 
we really need @JoeWatkins to implement getters/setters
 
np :-)
 
public readonly doesn't make sense, readonly is the access modifier
 
user895378
3:30 PM
@JoeWatkins that's what I thought.
 
Hmm...
No, it's a public-visible property
readonly limits writes to protected, though.
 
user895378
but you don't need both words to signify that.
 
user895378
readonly implies both for you.
 
I think confusing, it would be better to just add readonly/immutable as another access modifier
 
user895378
well immutable doesn't make sense either because it can be modified internally.
 
3:32 PM
Right
Yeah, I see you guys' point
 
true
but readonly isn't one word
 
readonly $a; is clear enough
 
I don't like that ... or read-only ...
 
@JoeWatkins It can be if we want it to be
 
user895378
If protected weren't already a thing that would be the perfect word for it :)
 
user895378
3:33 PM
Go go gadget thesaurus!
 
what other words are out there ?
 
C# has readonly... not sure if it's the same.
Nope, C#'s readonly is different. It means write-once.
 
user895378
guarded
 
@AndreaFaulds yes, this one makes sense.
 
3:34 PM
thats actually more what I expect
which is why I said "that's strange" ...
 
hmm
public readable private $property ?
 
user895378
oh dear
 
yuk
 
yeah :/
 
3:35 PM
Just a thought, if people can already achieve this behavior with getters and setters themselves, wouldn't it make more sense to have a feature that closely aligns with existing expections? In other words, C#-style properties?
 
user895378
@Fabien If you have a chance can you gtalk me a URI that results in the issue you're seeing? It's hard to debug things without some form of failing case.
 
I might like that, but I don't like the C# approach to readonly-to-public properties
 
@AndreaFaulds any particular reason why? You find the syntax ugly?
 
No, I don't like having two different properties
I don't want $length and $Length or something.
 
@KevinMGranger which is my suggestion
but yeah, what Andrea said ^
it does give internal properties
 
3:37 PM
Good point, I'm used to just doing C#'s auto-implemented properties which creates the private version for you
 
these could be just internal properties though
 
user895378
internal might be a good keyword
 
i.e. not reachable from within the instance
 
internal sounds too much like private
 
user895378
yeah kind of.
 
3:40 PM
another language implementing something in a particular way doesn't tell us anything about how we should do it necessarily ... I'd forget getters/setters for now, they don't depend on each other and getters/setters got a no before ...
 
they got a no before? why?
 
It was way too complex
It tried to do all the things
 
it doesn't tell us anything but we should probably think about why we want to deviate from what people would expect, which is a guarded property ... I think I like the definition we have now, but it needs justifying beyond "that's easier" or "first idea that came to mind" ...
 
I can't remember if I was able to vote, but I would've voted against it
 
extremely complicated
 
user895378
3:41 PM
I would have voted against it too.
 
was why I voted no ...
 
Right
 
couldn't get the chap to do over ...
 
@JoeWatkins You know, someone else just suggested guarded (@rdlowrey?), you just said it, and I think it's alright.
public guarded $foo;
On the other hand, it'd sound weird in an interface
 
user895378
why?
 
3:42 PM
I'm not saying about the keyword, I'm saying about the behaviour, where the constructor is the only method able to set the property, it's guarded in that sense, if we're going to be more lenient and allow any member method to modify the property then it needs justifying ...
 
user895378
My only justification is perf.
 
explain that ?
 
Mine is because it's simply nicer and clearer
 
why is it talking about readonly and final...
 
user895378
3:43 PM
I just want to have some safety without adding lots of superfluous method calls to access a property.
 
I think properties should be accessed as properties
 
user895378
Some properties are just properties and using a function to get at their values is totally superfluous.
 
I much prefer $foo->thing over $foo->getThing()
If it's read-only, I don't care, I'd still much rather type the former than the latter
 
user895378
Cuts down on unnecessary code as well.
 
That too, it's a pain to write getters and setters
 
3:44 PM
@FlorianMargaine yeah that proposal went a bit far
 
And just because an IDE can write boilerplate for you doesn't mean we should require boilerplate
 
to be clear
<?php
class Foo {
    readonly $bar;

    public function __construct() {
        $this->bar = new Bar(); # Fine
    }

    public function setBar(Bar $bar) {
        $this->bar = $bar; # Not fine
    }
}
?>
I'm talking about that ...
 
Right, so I won't call it readonly, because what you're describing there is what C# does, not what I'd like to do
 
I expect __construct to work and setBar to fail because readonly and outside of guard ...
 
user895378
What benefit is there to restricting assignment to the constructor (aside from it likely being easier to implement internally)?
 
3:46 PM
Basically I want something like C#'s public $foo { public get; private set; }
 
maybe there isn't any, but thats what I expect, because borrowed concept ... so I'm just asking the question so someone can prepare the answer :)
 
@rdlowrey I belive the main reason that's done in C# is to handle poorly done re-compilation
 
user895378
@Danack I updated the nbsock php requirement. Let me know if composer still yells at you in 5.4?
 
class Foo {
    readonly $bar;

    public function __construct() {
        $this->bar = new Bar(); // fine
    }

    public function Baz() {
        $this->bar = new Bar(); // fine too
    }
}

$foo = new Foo();
$foo->bar; // fine
$foo->bar = new Bar(); // not fine
 
But without a magic second property, and hopefully as a single keyword
 
3:46 PM
@JoeWatkins what they want ^
 
Because class-level consts are compiled in as the value themselves when referenced externally
So it doesn't necessarily make that much sense in an interpreted language
 
@FlorianMargaine Yes, that's what I'm after.
 
@FlorianMargaine I get that, and I like it, but that's "I like it" is not enough to justify it I don't think ... if we're going to borrow a concept ...
 
I also prefer it for interfaces
 
user895378
@AndreaFaulds yeah, so verbose. I'm sure we can come up with a more concise syntax.
 
3:47 PM
Forgive me for a moment for using readonly, but:
interface String { public readonly $length; public function getChar(int $index); } say
 
@FlorianMargaine Why not use a const then?
 
@rdlowrey amphp/dns also requires 5.5 currently.
 
@rdlowrey public property $foo { get; } is pretty concise.
 
user895378
dangit.
 
@Machavity it's not a const. Notice the Baz method
 
user895378
3:48 PM
@FlorianMargaine isn't the property keyword superfluous there?
 
Ah
 
Now, this doesn't require length to be mutable... but you could do it if you want. public $length would be a superclass of this hypothetical public readonly $length
 
@rdlowrey it means "generate getters/setters"
 
It allows you to write nicer interfaces.
 
although... yeah, not necessary
 
3:49 PM
@AndreaFaulds can you put that concisely? what do I think on what?
 
user895378
@FlorianMargaine The the initial public modifier is superfluous.
 
So you want something like a protected property but globally readable
 
user895378
you only need one, not two.
 
@ircmaxell On adding a keyword that'd make a property public-readable but private-writeable
 
@Machavity yes :)
@ircmaxell this: chat.stackoverflow.com/transcript/message/19536840#19536840 (and readonly is not the correct keyword)
 
user895378
3:50 PM
@Danack Why do you need 5.4 again?
 
I would assume that __get() could get you there tho
 
@Machavity yes, but it doesn't scale.
 
user895378
The existing API is not the problem. You can fake this now. But magic is slow (and ill-advised).
 
i.e. works for 1 property... not so much for more
 
user895378
We're trying to speed up property access.
 
3:51 PM
why not just take CSS's approach. If only one visibility modifier exists, use that for both read and write, otherwise it's read write $var = default; so, public private $foo = "bar";
 
@rdlowrey I wanted to use it on a clients server...if there's actual reasons why it needs 5.5 then meh - but if it's just because the composer files are wrong then it seems silly to exclude it.
 
and if you couldn't tell,
 
@ircmaxell I did semi-seriously suggest public readable private $foo
 
I thought you'd lost it for a minute there ...
 
user895378
3:52 PM
@Danack Well they aren't wrong, but the main amp repo that everything uses supports generators and yield ... if you steer clear of things that use generators you can use everything with 5.4, but technically it might not be safe.
 
user895378
So dropping the requirement on the primary repo to 5.4 is a bit questionable.
 
user895378
The existing composer files are correct to require 5.5
 
@DaveRandom pretty soon.
 
:-)
 
Ooh, so...
The DOM spec and other W3C specs use readonly attribute in their IDL
 
3:55 PM
@rdlowrey I think we've done this before - although it supports using it in generators, I don't see any yield in the actual amp lib. So there's no reason not to use it with 5.4 is there?
 
While it'd be different from C#, sure, I'm not sure readonly is that bad.
 
@AndreaFaulds it's write-once-in-constructor though
 
user895378
@Danack Yeah, the only generator usages have to be instigated by the user, so it should be fine. Anyway, I've updated the dns thing to use 5.4. Should work now.
 
That's an implementation detail.
 
and it's in the IDL... not in the class.
 
3:56 PM
You have no idea when the DOM changes those properties
 
yeah... the thing is, we're worried about implementation details
 
Sure.
 
if it were for interfaces? I wouldn't worry
 
@rdlowrey Thanks. I forgot, I'm using it in Bastion which would be good to reach as many people as possible.
 
I see your point... but as Joe said... strange...
 
user895378
3:57 PM
@Danack Yeah, 5.4 is a legitimate audience target. I was just being lazy.
 
Aha...
 
zend opcache came in 5.4 or 5.5?
 
political $foo; - everyone can read about politics, but only a few have any power to change it
17
 
5.5
 
@AndreaFaulds lol
 

« first day (1466 days earlier)      last day (3482 days later) »