« first day (1661 days earlier)      last day (3287 days later) » 

7:00 PM
@FlorianMargaine you have that: function() {$foo = 1; $bar = 2;}
 
@ircmaxell break variable variables
Prohibit them entirely in a function with variables that have type declarations, say
 
no, have a typed (and possibly immutable) variable, while still being able to change them when assigned to a different variable
function foobar() {
    int $x = 2;
    $y = $x;
    $y += 1.5;
}
 
Make the type/mutability a property of the variable holder, not the zval
 
@LeviMorrison no need to wonder about scoping... but actually, still do. So no, no reason.
 
@Andrea "variable holder"?
 
7:03 PM
There is no worthwhile feature that variable variables can do that using an array and lookups cant.
 
@ircmaxell Er, wherever you're storing information about the variable itself, rather than its value
 
I wish we'd remove variable variables entirely.
 
@LeviMorrison JS did!
 
"strict mode" RFC :)
 
@Andrea so symbol table / hash table / etc???
 
7:03 PM
Well, JS didn't quite have them, but it had something similarly awful (with)
 
It simplifies analysis and you can still do anything you want with a hash.
 
@ircmaxell Yeah
Technically JS still has it, but I mean strict mode JS
 
interesting. As I see, you'd need to have 3 flags: IS_TYPED=1, IS_NULLABLE=2, IS_CONST=4... You could even do that simply as a tagged pointer...
 
Where do you store the type itself?
 
well, without nullable types you wouldn't need to
 
7:05 PM
nope
Inheritance and interfaces
 
crap, yeah
 
I had the same idea before, see ^^
 
create a separate symbol table with the type information
but tag the pointers to the zval in the symbol table/CV so that you only need to do the lookup if it exists...
 
@ircmaxell a) Forbid referencing and b) emit opcodes for type checks everywhere the variable is mutated ?
 
^ or that
That's the advantage of eliminating variable variables
 
7:07 PM
@NikiC b) isn't possible
 
You have this info at compile-time
 
not with objects
 
yeah :/
 
@ircmaxell are we referring to variable types or property types here?
 
class Foo {
    private string $bar = "test";
}
@NikiC I was hoping to get both with one shot
 
7:08 PM
okay, properties are a different matter
but they have some more leeway in the way of acceptable overhead
 
An option for properties would be to make typed properties virtual
i.e., replace with hidden $__bar or whatever, and use __get and __set
 
Uh, no please.
 
Performance, though.
 
performance?
 
With formal accessors the typed properties can literally become sugar.
 
7:09 PM
@ircmaxell Accessors are slooow. (I assume?)
 
@Andrea But predictable which means they can probably be optimized.
 
we're talking C here
 
Well
For typed properties you don't even need special accessors really.
Forbid referencing, add type checks to PHP's internal property store/fetch, done (hopefully)
 
Hi everyone. I'm looking to improve the quality of my answers on stackoverflow, as I've been warned to improve them or I'll be banned from asking questions. Please could anyone give me some pointers, specifically this question? stackoverflow.com/questions/30038096/…
 
7:11 PM
forbid referencing everywhere... which is kinda crappy
 
You need to stick the type info somewhere, but zend_class_entry is already a monster of epic proportions so nobody cares
 
@ircmaxell Only forbid it for typed variables/properties only, not everywhere
 
@ircmaxell ($c ^ "\x30") <= "\x0A" || (($c | "\x20") >= "a" && ($c | "\x20") <= "z")
 
It'd be quite irritating, it's true :/
 
@bwoebi that faster than the hash table lookup?
 
7:12 PM
array $foo; wouldn't work with many array functions :(
 
@ircmaxell no idea, lol
 
let me test
 
ctype ??
 
probably not
 
@Andrea those functions are bad anyway
 
7:13 PM
if it were C, it'd be definitely the fastest… but PHP… probably not
 
@NikiC Probably.
another option is IS_SUPER_INDIRECT_SPECIAL_SNOWFLAKE_REFERENCE
 
@bwoebi slightly (like 0.0001 second difference, within the margin of error)
 
More seriously, you could add extra info to IS_REFERENCE
Who says it's always a fixed-length struct?
 
@ircmaxell slightly faster?
 
@Andrea But how does that help the ultimate goal of punishing references? :P
3
 
7:15 PM
@bwoebi yes
 
@ircmaxell lol
 
@NikiC "Ask not what references can do for you, but what you can do to kill off references!"
 
@NikiC You make poor references sad
but such expressions just show why we need chaining of comparison ops…
 
@Andrea Hear, hear!
 
@LeviMorrison Star it, then? :p
 
7:19 PM
oh btw. @ircmaxell … If you hunt for perf, ~0xff is faster than self::STATE_MASK…
at least in PHP 5.
 
OH: "Ask not what references can do for you, but what you can do to kill off references!" // via @sapphicorb
 
in PHP 7 it's same perf because compile-time evaluation
 
I changed it to a normal constant fetch, which is slightly faster than a class constant fetch
 
@ircmaxell and probably slower in php 7 ;)
 
oh?
 
7:21 PM
@ircmaxell class constants can be inlined.
 
as bob said, self:: class constants are propagated and folded
The same is not generally true of normal constants
 
@NikiC but normal constants can be inlined too, as long as we don't have opcache.
 
normal constants defined in the same file aren't?
 
(as long as they're already loaded when compiler encounters them)
 
@ircmaxell I don't think so
 
7:23 PM
See zend_try_ct_eval_const and zend_try_ct_eval_class_const
 
@NikiC well, I did it with external classe constants as well
@bwoebi also, I forgot to say thanks :-D
 
@ircmaxell they're inlined as long as they're loaded before the defining class is.
 
@bwoebi and you're not using opcache...
And usually the assumption is that you're using opcache
 
opcache is annyoing. It does caching PLUS optimization -.-
I still want that split into two exts
 
yes pls
I want a graph that I can work with
because doing function inlining at a AST level just sounds painful. I want to wire a graph together and let it figure out how to turn that into opcodes
 
7:27 PM
I wish I could use optimization-only… In that case I could use these ct_eval advantages and the opcache optimizations
@ircmaxell Not sure why that's so painful here?
 
exit paths
wiring the exits via AST gets dirty (think gotos and such), whereas with a graph it's trivial
 
okay
 
in fact, with a graph, the only real thing to do is mangle variables and replace the function call node with the function body (wiring the exits to the next node))
 
yep I get that
And what's with stacktraces etc.? They will get weird with inlining…
 
is there a way to get a function's body as string with reflection? as in js Function.prototype.toString ?
 
7:38 PM
hey guys, what are your opinions on a "jack of all trades" programmer who knows multiple languages? Better to know one really well?
 
@bwoebi yeah, that's tough
 
You just pay the performance tax.
 
@Brunaldo , its cool to know some multiple programming but the time though ...
 
You get faster evaluation for a worse debugging experience.
 
yeah, well… ^^
 
7:42 PM
also, $reflectionParameter->isString() // isBool isInt isFloat, right?
 
@razzbee true
 
well, actually, the location information of the opcode is still correct
so the only difficult part would be the arguments and determining which function you were in
 
@Brunaldo , As a php programmer , I did learnt some python and Groovy (An easier alternative JVM lang) , I am doing android but the time isnt much , but its a must for me since the more you know the more you earn ..
 
@razzbee at my placement I've learnt the basics for php and javascript. I know java from Uni but I'd too like to learn python. I don't know if it's all feasible tbh
tried a bit of android too
 
@Brunaldo Try to get a deeper understanding of at least one lang , I would suggest PHP or Python since they would somehow comfortable , After try to practice as much as you can. Then from there you can start your next lang.
 
7:53 PM
@razzbee makes sense. Thank u for ur insight!
 
8:06 PM
I wonder whether it's worth trying by-value-only in 7.1 and reconsidering in 7.2 whether by-ref is needed.
 
@bwoebi you mean whether a separate syntax for by-ref is needed in 7.2?
 
yes
 
k
 
(I didn't mean replacing… I'm insane… yes… but there's still a tiny bit of sanity)
 
still going with block? or only expression?
also, phase 2 of this XSS project is to build a templating engine around it :-)
 
8:15 PM
there's one reason for the block… doing two ops. Like advance + return
Yet another templating engine…
 
@bwoebi one with context-sensitive escaping, which none of the current ones do, at all.
@bwoebi Hack doesn't have block mode, and it gets by just fine
 
Will it be a magic fix-all-the-things templating engine?
 
@ircmaxell it doesn't?
@ircmaxell no, hack has it.
 
@ircmaxell Hack definitely supports blocks
 
does anyone here know how to work with Auryn
 
8:17 PM
nevermind. arg
 
@ziGi just ping @rdlowrey ^^
 
this is why I hate ambiguity in documentation
 
@rdlowrey I am wondering about something in Auryn, please ping me when you are here
 
we should require parser rules in documentation to tell you what the syntax is
 
@ircmaxell Which is why I just open the parser definition instead of bother reading docs
 
8:18 PM
@NikiC that's the goal :-)
 
@NikiC exactly, haha
 
@ziGi What, exactly?
 
oh yes, you can help me too
 
@ircmaxell Have you seen Ur/Web?
 
if I have 2 different controllers that in the constructor have some interface Foo var and I want to make the first controller to be injected with fooAConcrete implementing Foo and the second controller to be injected with fooBConcrete implementing Foo
 
8:22 PM
@LeviMorrison no, but reading quickly it seems like it doesn't do context-sensitive escaping in the way I'm talking about
 
how do I tell Auryn which concrete implementation it should use exactly
depending on the controller it makes
 
<foo>{$foo}</foo>
<script type="text/javascript">
$baz = "{$bar}";
</script>
 
@ircmaxell It strongly types everything. SQL, HTML, CSS
 
how would you encode $bar?
 
And I mean very strongly types.
@ircmaxell For a JavaScript string? Is this a trick question?
 
8:25 PM
no, it's not a trick
that's what I want it to do
 
@LeviMorrison how can I say if you are going to instantiate this class, then use this parameters
 
@ziGi You set up concrete params.
So for instance:
 
actually build a bloody mixed-language AST out of the template, and then escape the context specific for the node it's injected into
 
You want to inject different things for each param here? function __construct(Foo $a, Foo $b)
 
yes
and this function is in a concrete BarController
 
8:27 PM
Then assuming that class with the constructor is named ziGi:
 
do I do $injector->define('BarController', [':a' => ..., ':b' => ...]);
 
$injector->define('ziGi', ['a' => 'FooBar', 'b' => 'FooBaz']);
 
aha ok
 
this is why magic injectors are not a good idea ;-)
 
I don't think you use : there but I am not completely sure.
 
8:28 PM
@ircmaxell "magic" injectors?
 
@ircmaxell They are fine as long as you have control to do whatever you want on any given case.
(Assuming any injector is fine)
 
@LeviMorrison which makes them no longer magic ;-)
 
@ircmaxell Just because 10% isn't magic doesn't mean the other 90% isn't
 
the idea is that you have a file with the dependencies defined, so you don't have to deal with it in the controllers and down the chain
 
@LeviMorrison is it obvious how it works knowing that 10%?
 
8:30 PM
I think these injectors are significantly over used anyway.
 
++
 
@ircmaxell there's exactly one place for the injector. When calling the route handler.
 
@LeviMorrison do you split your DIC definitions instead of keeping them in a single file, I was long wondering about this
 
@bwoebi If there is only one place why do you need it in the first place?
 
@ziGi usually keeping them in one single file. You anyway don't have that much things to inject it.
 
8:32 PM
@ziGi I typically only use the magic stuff for everything ;)
I don't have definitions.
 
but then if you use the magic stuff
it means that the typehints are concrete classes
 
@LeviMorrison usually I just define a very few things like the database connection params etc.
 
instead of interfaces
how do you decouple it?
 
I simply don't use Auryn for those ;)
I only use Auryn for incredibly simple things, personally.
 
interesting, what do you do then?
 
8:35 PM
@ziGi You have the choice between coupling in a definition or in a typehint… The latter is usually simpler.
 
exactly
 
This is partly because I don't have a lot of time to spend on hobbies so I generally choose to work on PHP core, the PHP.net website or on something that isn't programming.
 
I see
 
> Ur/Web provides guaranteed security; certain kinds of security vulnerability are impossible. For example, modulo any compiler bugs, any Ur/Web application that the compiler accepts is free of code injection vulnerabilities.
 
it's free of Ur/Web code injections
not JS injections in the rendered HTML
 
8:37 PM
@bwoebi if you choose the latter it's a bit harder to test cause you cannot inject a mock
 
@ziGi You just have to extend the class and overwrite its methods?
 
@bwoebi ah, and call parent?
no thanks
 
@ziGi no, not call it… overwrite.
 
spread the word: 5th OMC is this year and international: openmusiccontest.org
 
@ircmaxell It either supports the script tag or forbids it, I am quite sure.
(but not 100%)
 
8:42 PM
just found a page in my application that references data that does not exist, allows the user to hit save, tries to save, but has no logic at all that processes the incoming data, and then lies to the user about having it saved
This page is about seven years old.
Nobody has noticed that it's been broken for the past seven years.
 
@Charles It's a feature!
 
@bwoebi yeah, I see I don't know, apples or peaches
 
@PeeHaa The other devs are lamenting that it's not at least trying to save data that doesn't exist, because we tend to do a lot of that anyway... then it'd have been a normal bug for us.
 
:P
 
8:45 PM
Now, to decide whether we should just remove the page and see who notices or go through the effort of fixing it.
 
@Charles Do a quick grep through the accesslog
 
Judging from what it's trying to do, it'll never have worked anyway.
 
Maybe it isn't even used
 
Hmm, lemme see here...
541 accesses since March 2013...
.. 8 of which are saves.
No wonder nobody's noticed that it's broken.
 
ha! 8 suckers!
 
8:50 PM
I suggest all the DIC definitions to be put in Environment variables instead in a definition file :D
 
Two suckers, one of which doesn't work here any longer, the other whose job it is to maintain the data. I guess I'll just mail her.
 
:)
 
that way moving the environment would say what objects are being used :D
 
@ziGi Don't give my former coworkers any "smart" ideas.
 
ahahaha :D
 
8:51 PM
lol
 
who're your former coworkers
 
@ziGi The ones that decided that about 2/3rds of our important bootstrap information should be in Apache-defined env variables that we then have to magically conjure out of thin air for things like, oh, I dunno, cron.
 
abstract the abstractions
@Charles ahahahah seriously
 
well configurations like passwords etc should be in env vars
but 2/3 of the bootstrap is a bit extreme
why don't you put the whole code in there :D
 
8:53 PM
@ziGi Why should it be in env vars?
 
why not serialized in memcache
 
well, no, not 2/3rds of the bootstrap, 2/3rds of the things bootstrap can decide to do based on what server it's running on...
... I hate this codebase.
 
on bootstrap you unserialize it and run it
if your cache goes down then just serialize the whole code on the next request and put it in memcache
after all reading from the RAM is faster than a HDD
:D
 
@ziGi Once again, please stop giving my former coworkers "smart" ideas.
 
@Charles are your former coworkers here in the chat?
 
8:55 PM
No, thank goodness.
 
hehe
 
github.com/WesNetmo/php-anonymous-class @NikiC i'd love having both instances of anonymous classes and actual anonymous - instantiable - classes stored in variables
 
UNLESS THEY ARE
 
are they really so "smart" that they'd do it?
 
@ziGi we hope
 
8:55 PM
GET OUT HERE BAECHLE AND MEET ME FACE TO FACE, I WILL ENNNNND YOOUUUUU
 
@hakre github.com/WesNetmo/php-anonymous-class you know what to do xDxDxD (seriously: don't do it)
 
@ziGi I dunno, the screwed up caching layer we now no longer use is might be a clue
 
btw i noticed this:
Fatal error: Cannot use "parent" when no class scope is active in /in/IioA8 on line 16
when using $closure->call($obj)
 
@ircmaxell I think the serialization slows down the hole bit, so maybe there should be a smarter way to cache it
 
it's a regression anyway, because on php7@20150401 worked
 
8:58 PM
I'm all out of cherry yogurt drink :(
 
@Worf 3v4l.org/vO3ig <-- there you go :-P
 
luckily I have some plain yogurt and cherry jam left, so I can mix some of it with water
 

« first day (1661 days earlier)      last day (3287 days later) »