« first day (1467 days earlier)      last day (3472 days later) » 

2:00 PM
@DanLugg nvm, figured out on my own.
 
@Leri Okie doke :-)
 
user895378
@Fabien I believe if the port is missing then 80 will be assumed, but I'd have to double check. You can't go wrong by specifying the port in the address, though. You can also use the domain name if you want and it will be resolved.
 
furry
 
fuzzy
 
user895378
@Fabien If you want to set a separate proxy for encrypted requests there's also Client::OP_PROXY_HTTPS
 
2:01 PM
awesome thanks.
I've mostly built what I need to and I am not disgusted with myself. This is a nice milestone.
 
posted on October 22, 2014 by kbironneau

/* by el_curtismo */

 
@Jimbo No - he's a douche. I think there isn't enough ignoring in this room...
 
@bwoebi Hmm, intersting :)
 
@Ja͢ck or is it a bug?^^
 
I suppose it could be considered a regression ...
 
2:09 PM
there's no regression.
 
Well, yeah, because there weren't any test cases for it
 
what you have changed is correct. What I want to discuss is whether array_diff is correct or not… And if it should be documented.
 
Hmm, give a min.
You get the same effect by creating an array and then unsetting its elements, followed by another [] insert.
 
user895378
@Fabien You're still still seeing memory explode, though, right? Or no?
 
2:14 PM
Still, I would agree we either document it or fix it :)
 
@rdlowrey Negative. Works well.
Using dev
 
user895378
Okay, I'm going to give you a code snippet in a minute and ask you to add it to your code to verify for sure that memory isn't leaking.
 
Sure.
 
@ircmaxell back
 
yo
 
2:19 PM
:)
so, was wondering how to change people's minds ... even liz said we were wasting time on anonymous classes ...
 
user895378
@Fabien Actually, nevermind. I have to do some stuff before that would actually be useful. Don't worry about it :)
 
Well, here when you need me :)
 
@rdlowrey did you have time to poke the message parser?
 
@JoeWatkins I think it's an interesting time to try to bring the community together, since a lot of people have voiced that they want such a feature. Time to make a compelling use-case argument
 
@JoeWatkins My issue with the RFC actually is that I cannot think of any way to have a consistently shorter syntax... I feel that the syntax is too verbose, too… but I have no better idea :-(
 
user895378
2:22 PM
@m6w6 Ugh, I didn't. I will stop what I'm doing and look at it right now. Is there any documentation for it yet or should I just browse source?
 
let me push it, it's just a class with 3 methods though
 
@ircmaxell okay, and what will that look like ?
 
Well, unit testing for one
 
ah right yeah, seb brought that up a while ago iirc
 
user895378
Unit testing is a big one.
 
2:25 PM
yup, and putting that in the RFC directly should be huge
 
@rdlowrey paste.jesse-obrien.ca/F3H (Pretty much copied from the example folder, but seems like that function wants an IP not an URL)
 
user1596138
ob_start();
echo($folder.$files[$rand]);
$Random1 = ob_get_contents();
ob_end_clean();
 
user1596138
// I wish that was a joke
 
@Jhawins lol. file roulette! \o/
 
@rdlowrey pretty rough, still: test-m6w6.rhcloud.com/mdref/http/Message/Parser
 
user895378
2:29 PM
@Patrick Yeah, the point is to determine whether or not the address is already an IP or needs DNS resolution. Let me look at why that code is not doing what I intended.
 
@rdlowrey you need master for http\Message\Parser
 
@JoeWatkins what do you think of this syntax:
 
user895378
@m6w6 okay, thanks. I will give you feedback sometime today. I appreciate your work :)
 
new YourClass() {
/* some method */
};

or

new YourInterface() {
/* some method */
};

and

new YourClass implements a,b() {
/* some method */
};

in case one wants to implement multiple interfaces, but not extend a class:

new class implements a,b() {
/* some method */
};
 
user1596138
@PeeHaa lol well the OB shit was the insane part
 
2:30 PM
@bwoebi I like that.
 
@rdlowrey great, thank you
 
user1596138
Or is there a legitimate reason to start output buffer, echo once, end buffer?
 
@Jhawins What's so strange about ob_*?
@Jhawins Templating ?
 
user1596138
Why wasn't it just $Random1 = $folder.$files[$rand]
 
@bwoebi I had a variation of that before and you said it wasn't clear ... I think the clearest syntax is the one we already use ...
 
user895378
2:32 PM
@Patrick I'm trying to figure out how you're getting an error there because the inet_pton() call uses error suppression on purpose ... can you run a composer update and be sure to specify 1.0.x-dev for the artax version?
 
@JoeWatkins you had a variation which had issues with the case of multiple interfaces.
 
@rdlowrey we have xdebug.scream = 1
 
@JoeWatkins I think this variation should cover all cases.
 
@Jhawins That doesn't include the contents of a file :P
ow wait
 
user1596138
@PeeHaa huh? Well it's not strange, I just don't see the reason for it here? // half the reason I posted it was because I wondered if there was
 
2:33 PM
It's an echo
Yeah I missed the echo in there :P
That is pretty stupid indeed :D
 
@tomwilde The @ operator isn't there to be ignored…
 
user1596138
Full snippet in case you care hahaha. Yeah I'm not seeing the point
 
user895378
@tomwilde ohhh ... well there's no way around that then. The function is intended to fail if the address isn't a valid IP. /cc @Patrick
 
@Jhawins Yeah that makes no sense at all :P
 
user1596138
2:34 PM
:D
 
user1596138
:wtf:
 
user895378
I could use filter_var() but that requires an extension and inet_pton() is part of the standard library ... I prefer to avoid ext/filter as much as possible.
 
I suspect that should be a require / include
 
user1596138
Hahaha oh man!! @PeeHaa turns out instead of making that a function even, he literally repeats that snippet 3 times.
 
@rdlowrey you could use an evil regex… But your code is right… it works and so it should remain. xdebug.scream is … xdebug…
 
user1596138
2:35 PM
But with $Random2 and $Random3
 
// An anonymous class that extends Foo
// and overrides some methods
$object = new Foo($constructorArgs) {
    /* override Foo methods */
};

// An anonymous class that extends Foo
// and overrides some Foo methods
// and implements BarInterface
$object = new Foo($constructorArgs) implements BarInterface {
    /* override Foo methods */
    /* implement BarInterface methods */
};

// An anonymous class with no parent
// and implements BarInterface
$object = new class($constructorArgs) implement BarInterface {
 
@Jhawins :P
 
@bwoebi @JoeWatkins ^^
 
user895378
PHP emits a lot of spurious warnings and notices, especially for socket operations ... xdebug.scream = 1 is going to cause all sorts of problems because I have to @silence a lot of these on purpose.
 
user1596138
Well fun. This isn't too hard to fix :)
 
user895378
2:37 PM
@bwoebi agree.
 
@DanLugg any reason why the args are before the implements keyword?
 
$object = new Foo($constructorArgs) {
    /* override Foo methods */
};
is ambigious, you expect a object of class Foo and that is not what you get ...
(had that before)
 
@JoeWatkins ambiguous with what?
 
because I think they get lost if they come after the rest of the implementing or overriding definition
 
what's the possible alternate meaning then, Joe?
 
2:38 PM
you do not get an object of class Foo, you called new Foo()
 
but … an expr cannot be immediately followed by a { ?
 
@rdlowrey it was not the cause, xdebug is disabled now. But it looks like the problem is with the error handler paste.jesse-obrien.ca/F47
 
user895378
@Patrick Oh, that's easy to fix.
 
@JoeWatkins so, it's all just parser magic?
 
user895378
You should always do this in your error handler to honor @ suppression:
 
user895378
2:42 PM
if (error_reporting() === 0) {
    return; // if error suppression was used, pull out here.
}
// otherwise, do whatever you were planning on doing
 
@rdlowrey That worked. Thanks a lot.
 
user895378
@Patrick no problem
 
@rdlowrey thanks from me too.
 
user895378
please ping me anytime you guys have questions about code I wrote. It's always possible that I screwed up :)
 
So far every time it ended up being on our side though ;)
 
2:47 PM
s/It's always possible that/
:D
 
crap, I keep forgetting how to optimize a PHP extension build
 
user895378
@PeeHaa probably. The longer I write code the more likely I believe problems are my fault and not someone else's :)
 
@rdlowrey Same here ;)
 
user895378
I used to think all of my code was perfect. Now I think all of my code is bug-ridden and terrible.
 
@rdlowrey well, that it's terrible is an exaggeration :-P But bugs always pop up, even after so many iterations…
 
user895378
2:51 PM
hehe yeah. It may look pretty, but it's probably broken.
 
@bwoebi not sure what you mean ..
 
@JoeWatkins With ambiguous you mean r/r conflicts in parser?
 
I mean for humans actually, using the placeholder "class" to mean anonymous class seems to make sense, when I showed you the new Foo() {} version you were confused by that, and it is confusing, it's even more confusing that you don't get an object of class Foo but one that inherits Foo ...
it so happens that new class_name_reference ctor_args does cause a conflict in the parser, not one that you can't get around but one that makes it a little more complicated ...
 
user895378
@JoeWatkins My $0.02 is that class seems the sensible choice.
 
I added an edited version of sebs initial communication ...
is he on so ?
 
2:56 PM
@JoeWatkins Okay, what about $object = new class ($constructorArgs) extends Foo { ... };
 
@DanLugg that's how it is now :s
 
Oh. Sorry ;-) That's fine then.
 
bin/compile_pecl --optimize compile foo src/functions.php <-- results in a foo.so file in your current working directory.
 
cool
 
Is the constructor arglist before the extends/implements/overriding body?
 
@DanLugg yes, always new class ($args)
 
@JoeWatkins B-yewtiful, thumbs up, plus one, vote in the box.
 
user895378
@AndreaFaulds how far did you get with readonly yesterday?
 
working I think @rdlowrey
 
@rdlowrey Did you see the patch? :)
 
3:02 PM
oh she's here, my thing just updated late ...
 
It's all done aside from reflection. Also, I realised today I need to add a test for unset
 
sorted public readonly, readonly public ?
 
user895378
\o/
 
user895378
@AndreaFaulds If you want help writing up a full RFC let me know. I'd really like to see this implemented.
 
3:04 PM
@JoeWatkins Yeah
 
@JoeWatkins add virtual for the sake of it and treat it as a comment
 
Plz kill the guy that linked cursors.io a few days ago.. addicting... :P
 
@rdlowrey I don't think writing the RFC will be too difficult, but if I really need your help I'll ask you
 
@AndreaFaulds So, it's still the public-readable private-writable approach?
 
user895378
@AndreaFaulds looks great. ++++1
 
3:05 PM
@DanLugg Right. Or more specifically, <accessibility>-readable and <accessibility-1>-writeable
so public readonly = public-readable, protected-writeable
and protected readonly = protected-readable, private-writeable
 
I see.
 
There's no private readonly as there's nothing lower than private.
 
user895378
readonly basically does what I wanted from the failed getters/setters RFC without adding on "all of the things" (which were, I think, why that RFC failed).
 
Yeah
I think it'd go well with getters/setters too, for interfaces.
 
@rdlowrey Yea. I don't know if that's a good thing.
 
3:08 PM
interface Foo { public readonly $thing; } - doesn't compel you to implement a setter if you don't want one
 
@JoeWatkins by the way, that's just what Java does too…
 
user895378
@DanLugg I don't know why you'd want anything else out of it. You can already achieve everything else with __get()/__set() ...
 
By the way @JoeWatkins, I'd prefer it be __toKey than __hashKey
I mean, it goes better with __toString... and there might be other ways to hash something.
 
@rdlowrey __get/__set are sloppy. Proper accessor/mutator definitions per-property are sensible; mocking the behavior through __crappy/__magic are not so much, IMO.
 
user895378
@DanLugg I agree that magic sucks. But I don't think getters and setters should be built into the object model in the first place, though.
 
user895378
3:11 PM
getters and setters are quite often (almost always?) bad OOP.
 
@rdlowrey Disagree. Very much so.
 
user895378
I don't really feel like arguing this point, TBH.
 
@JoeWatkins also, Joe, it's just something you get used to. Like to all syntax which is sensible.
 
@rdlowrey Likewise, agree to disagree; however I just don't want another half-feature.
 
But IMO, current is just too verbose…
 
3:12 PM
I think getters and setters are good as they allow plain properties and function properties to be indistinguishable
Hides implementation details
It also means we could allow properties in interfaces which I'd very much like
 
user895378
Except getters/setters mean external code knows what's going on inside the object's black box. Too much knowledge.
 
@AndreaFaulds That's very much the point too; interface Foo { $bar { get; } }
 
No, they don't know what's going on, that's what's great
The problem is that you do now:
$bar->getFoo() vs. $bar->foo reveals implementation details
 
user895378
2 mins ago, by rdlowrey
I don't really feel like arguing this point, TBH.
 
user895378
Another time :)
 
3:14 PM
The problem is that $bar->foo is currently guaranteed to be side-effect free.
 
So?
 
How so?
It's not side-effect free. It mutates ->foo
Hmm
Also, we already have getter and setter magic methods.
 
I think he means when $a = $b->a invokes a getter that does something.
such as public $a { get { someSideEffect(); return $this->_a; } }
 
yup
 
So what though? It is very inoften I've seen properties exposed publicly, because of the lack of guarding. So most often you're doing $b->getA() anyway, which isn't guaranteed to be side-effect free (though sensible contracts will be)
 
user895378
3:18 PM
Getters/Setters. Evil. Period <-- I'll let someone else argue for me.
 
user895378
I just don't think getters/setters would be a good addition to the language.
 
user895378
 
user895378
This feature would be the source of so much terrible "OO" code.
 
Man just don't argue if you don't want to, I can find you an article why gluten is evil or why microwaves can cause cancer :)
 
user895378
3:20 PM
@nikita2206 I'm not arguing. I'm deferring to others :)
 
By the way
In my ideal language, there are no properties
 
user895378
only functions \o/
 
You just have message-passing. Like in Smalltalk, say.
 
@rdlowrey ^ +1
 
Haskell has this, kinda. If you use the Struct thing (I think it's called that?) or something, it auto-generates getters
 
3:21 PM
My ideal language is Ruby with parameter-type constraints, generics and C-like syntax.
 
so you have this algebraic immutable datatype with getters
 
@rdlowrey uh, that first link is generally against setters/getters… and you use yourself getters and setters from time to time in your code…
 
there are no "properties" and "methods"
 
user895378
@bwoebi I rarely use getters/setters. Almost all of my methods are for passing messages, not property values :)
 
yeah, my ideal lang is haskell as well, but nobody wants to hire haskell developers :P
 
3:23 PM
I wouldn't say Haskell is ideal for me, it's a bit... uptight. It makes writing code more difficult than it needs to be.
But it has some really, really nice things
 
I <3 immutable datastructures
(Which, btw, readonly is great for)
 
user895378
@bwoebi Exactly. That's just a datastructure. Don't be fooled by the methods.
 
My ideal language is one where I don't spend time having to discuss what my ideal language is.
 
@AndreaFaulds That's another discussion. Readonly would be maybe great.
 
3:24 PM
@AndreaFaulds you mean record syntax learnyouahaskell.com/…
 
user895378
@bwoebi That request class is essentially just a struct with a nice readable API. Most objects shouldn't look like that.
 
@tomwilde That's the one.
 
@rdlowrey What would you say is the acceptable minimal headers to send to try and not get detected dodgy?
 
class Vector { public readonly $x, $y, $z; function __construct(...$args) { list($this->x, $this->y, $this->z) = $args; } }
 
@AndreaFaulds what does readonly mean there... what/where/when can they be written to?
 
3:25 PM
$foo = new Vector(1, 2, 3); $foo->x = 7; /* BANG! */
 
@rdlowrey How is $request->getUri() clearer than $request->uri?
 
@salathe Readable to public, writeable to protected. Which isn't exactly what you want for an immutable structure, but it at least prevents outside writes without needing to write getters/setters.
 
@AndreaFaulds Is readonly the name you're sticking with?
 
unwriteable :P
 
@AndreaFaulds why not create a new type "struct" (copy-on-write unlike objects) and add a sugar like struct readonly so that you can only fill its fields in the moment of creation?
I actually had a need for it a lot of times
 
3:27 PM
@DanLugg Yes. It's not ideal as C#'s readonly is different... but the name's been suggested before on the list, there's no better name for this specific thing that doesn't introduce awkwardness, and we already use readonly in the manual
@nikita2206 That's something which I think might also be useful. But we don't have that as of now.
 
user895378
@bwoebi It's not. It's just establishing an API contract via an interface that other people can rely on. If we could specify properties in an interface I would use $request->uri
 
@AndreaFaulds oh... ick. :(
 
Reducing a colleagues lines down from 17 -> 3. -_-
 
If people want C#-style readonly, we could always add final or immutable later.
 
by the way, sometimes, when you want to do some really bad things with "immutable" objects in php you can call $imObj->__construct($newState); and mutate it as you like :)
 
3:30 PM
Oh god
 
yeah, htat's bad
 
brilliant D:
 
@AndreaFaulds public readonly final immutable $foo :P
 
user1994804
Hey guys, Im having trouble grasping regex
 
user1994804
could someone please better explain this to me/?
 
3:31 PM
I need an advice. MySQL table for inserting visits, is better to use InnoDB or MyISAM? Per visit will be one insert and one select count. Which engine would be better and faster for that case?
 
@salathe Well, readonly and final/immutable wouldn't be conflicting, though unnecessary.
 
@salathe public static readonly final immutable $foo;
 
user1994804
(?!...) is a negative look-ahead because it requires that the specified pattern not exist
 
user1994804
Do what?
 
@DanLugg public static abstract readonly final immutable $foo;
 
user1994804
3:32 PM
For example, In a regex Im working with
 
@Stol3x If nobody else answers... don't worry too much. You can switch engine later.
 
@AndreaFaulds public static sealed final readonly immutable abstract virtual partial $foo
 
@Stol3x Unless you meet the very few criteria where MyISAM is better (basically full text search) InnoDB will almost always be better.
 
@DanLugg public static sealed final readonly immutable abstract virtual partial int $foo {get;};
 
@AndreaFaulds And now I'm on board ;-)
 
3:33 PM
@rdlowrey any reason why it's not allowed?
 
user1994804
[^a-z 0-9?!]
 
@DanLugg Improved... though sadly, we will never get scalar type hints so that won't happen ;)
 
Having readonly not mean read only within the class defining it is... no, I'm not a fan.
 
@AndreaFaulds Whoah whoah whoah! This is PHP here, we don't type things.
 
@Danack It means innodb is even faster for searching varchars etc?
 
user1994804
3:34 PM
Could someone please put this in plain english?
[^a-z 0-9?!]
 
@salathe This is my opinion. It should be locked when the constructor returns.
 
@DanLugg So what you're saying is I should GET OUT AND USE HACK INSTEAD
 
user1994804
I read: (?!...) is a negative look-ahead because it requires that the specified pattern not exist
 
@AndreaFaulds I wouldn't go that far.
 
@DanLugg C#-style
 
user1994804
3:34 PM
but dont "Get It"
 
@salathe Yes.
 
@YourAdrenalineFix that's a character class and it matches anything that is not a-z, a space, 0-9 or a question mark or an exclamation mark.
 
user895378
@Fabien Artax already sends everything you really need. The only thing you might add is a Cache-Control header. If you really want to get fancy to make your requests seem like they're coming from a human you can do things like randomize the amount of time you wait in-between request.
 
@Stol3x Short answer - yes. InnoDB has row level locking instead of table level locking, which results in the common uses of it be faster.
 
@AndreaFaulds Oh, a female dev? wow, rare to see :)
 
3:35 PM
@DanLugg That sounds best to me too
 
user895378
@bwoebi I dunno.
 
user1994804
Ahh
 
user1994804
Thats right. Because it's inside []
 
@bwoebi What's so funny?
 
3:35 PM
@Stol3x Also turn on the file per database in you my.cnf....it saves heartache later.
 
user1994804
makes it a character class
 
@salathe And while I understand that @AndreaFaulds' patch provides a useful feature, it also falls under the umbrella of accessors/mutators if also implemented a 'la C#.
 
user1994804
Im learning...
 
user1994804
I thought the ?! had special meaning
 
Robust features > narrow features > narrow features that hijack a keyword.
 
3:36 PM
@AndreaFaulds pff ≠ funny … oO
 
user1994804
Thats how I found (?!...) is a negative look-ahead because it requires that the specified pattern not exist
 
@YourAdrenalineFix yes, the square-brackets make it a character class and the caret at the beginning of it's contents makes it a negative character class.
 
@bwoebi OK, what's so shocking?
 
@DanLugg I can hear the "so, just go and use C#..." voices already :P
 
user1994804
I just thoght that the () was to illustrate this is what they were talking about
 
3:36 PM
@YourAdrenalineFix normally yes, ?! is a negative lookahead but inside a character class it's just the characters ? and !
 
@AndreaFaulds It's just "pfff" or "tzzz", nothing shocking or funny there…
 
user1994804
Awesome, Thanks
 
@salathe I know; I'm rather sick of that. Why we can't cherry-pick features based on their successes, and cater them based on their failures, from other languages is beyond me.
Cross-language feature similarity is not a deficit.
 
Q: is there a repo I can follow where all this discussion flows into?
 
@tomwilde github.com/php/php-src ?
 
3:39 PM
@nikita2206 cool that's what I supposed but wasn't sure cause I'm not on here very often.
 
so, I'm allocating strings, how do I determine how to free them?
 
@ircmaxell how or when?
 
@ircmaxell refcount
 
@AndreaFaulds I'm dealing with C primitives
 
3:42 PM
@DanLugg plus, if people choose to write their own "regular" accessors and mutators, implementing C#-style properties allows the readonly feature to not be hidden by them
 
@ircmaxell Well, you can't refcount them then and will need to dup on assignment
Which means you can just free when out of scope
 
I'm thinking of keeping a linked list of assignments, and then just iterating and freeing on exit
 
and on assignment to an existing occupied property
@ircmaxell Inefficient if doing lots of allocations since long-since redundant strings will be hanging around?
 
yeah...
I guess I can keep a refcount
 
Also, my approach, while inefficient if string ref'd in multiple places because duplication, means things are freed immediately and it's very simple to implement
 
3:45 PM
If you're looking for inspiration of a relatively minimal and clean object model that compiles to C: https://wiki.gnome.org/Projects/Vala
Also, refcounting. Deals with concurrency in a rather simple way. Some people find it too simple.
 
@ircmaxell github.com/antirez/sds possibly interesting
 
nah
 
@ircmaxell Its approach is worthwhile copying though: refcount before the pointer
This means no subtraction/addition needed for subscripts, and direct compat with C functions
 
@AndreaFaulds how do substrings work, though?
have to copy I assume
 
i.e.: char* make_string(size_t size) { char *str = malloc(sizeof(uint32_t) + size); str += sizeof(uint32_t); return str; } void addref_string(char *string) { (uint32_t)(string - sizeof(uint32_t))++; }
@tomwilde Right, but you'd need to anyway with refcounting
 
3:52 PM
true.
 
@AndreaFaulds I'm just going to reimplement zend_string from 7...
 
@ircmaxell Alright then.
 
Another good tool to reason about a program's memory is SSA http://en.wikipedia.org/wiki/Static_single_assignment_form
Although it's more commonly used by optimization theorists
 
No need to reimplement though, just copy its source.
 
3:56 PM
I should RTFCode :P
 
5 internet points to the person who can tell me wth is happening here
 
@Fabien What part in specific?
 
Well as a whole it gets the url from an url shortener. I'm trying to do the PHP version.
 
Or do you mean the entire callback for bc.vc?
 
Yeah
bc.vc is an ad/url shortener
 
3:59 PM
@Fabien xy problem
 
"Ads Skipper - No More waiting to skip their ads"
I think it's skipping an ad.
 
What is it you are trying to do?
 
Sample Get the url it redirects to.
 

« first day (1467 days earlier)      last day (3472 days later) »