« first day (640 days earlier)      last day (4301 days later) » 

6:00 PM
@gorelative [tag:cv-pls]
 
@Neal , yes , and the anonymous function is there only to provide lazy initialization
you could just pass in an existing PDO instance
 
@tereško but as @Truth said, isn't it global? (the PDO instance)
 
lol, aaaand its gone
 
6:01 PM
fantastic: Just found a 2009 calendar, it's working for this year, too!
 
Why would I want it to be global?
 
@rdlowrey can you help me, I'll listen
 
2009 calendar... ?
 
@Neal , no , php has different scoping then javascript
 
@tereško yes, yes I know that. just .... hmmmm
 
6:02 PM
@tereško Not the PDO, but the provider and factory are both global, aren't they?
 
Ok. I might try to switch to Dep Injection.
Still using Mysqli though.
PDO is for later.
 
@Truth no , they exist only in the scope of that file ( or method , if they are inside a class )
 
@rdlowrey ++
 
@tereško My point is, eventually, something will have to be on the global scope
 
@gorelative no just seeing it's 2007 and 2008 indeed.
 
6:04 PM
@Truth when Neal says "global scope" , he means javascript like global scope window.foobar = 'something';
 
@tereško That's not what I mean
 
@Truth in php variables are global only if they are defined as global
 
Let's say I'm running a simple index.php
Whatever's not inside of a function/class/method there can be considered global, can it not?
 
no , because you cannot access them
 
unless I define global
Alright, got it, thanks :)
 
6:06 PM
i have 17 answers waiting for aacceptance
 
@Truth Yes, something will need to be on the global scope. But that should only be the main() function call to enter into your app. That's it...
 
disgusting :(
 
@gorelative Waiting for acceptance?
 
yes the little green check mark
my happy mark. I want to hit 4 digits :)
 
6:07 PM
why the f* is ::getInstance() there...
 
@gorelative How can you tell if an answer is waiting for acceptance?
 
goto your profile
 
How can you tell OP should accept your answers?
 
because those 17 the OP said "thanks for the answer" or some variaton
 
@Neal , when you get home, watch that video
 
6:08 PM
except for this one
1
A: Compiling Codeigniter's User Guide

gorelativeread the documentation... https://github.com/EllisLab/CodeIgniter/blob/develop/user_guide_src/README.rst download the guide to your local machine and compile it yourself.

 
@tereško can you help me (Imma help vampire tonight)
 
I cringe every time I see commented code checked into source control... Why is the code commented out? #justDeleteIt
 
@tereško if my wife lets me ^_^
 
@ircmaxell I usually do that with debugging
 
@ircmaxell but but but what if you want to see the code later?! #inoknowhowtorevertcommits
 
6:09 PM
But I delete those in production
 
6:08pm?
 
@Truth which is why I didn't say every time I see commented code. I said checked into source control
 
Ilol @ them in the master branch
otherwise, outside of that branch i could care less.
 
nobody wants to help me :sad:
 
6:14 PM
@webarto ?
 
pastebin.com/pQqssGHh line 19, and line 42 (I pasted in one file for convenience), why does it need singleton :S How to avoid it... if it's enough code...
 
@hookman You don't have any personal projects on which you could test your skills?
 
var m = 'messages', c, p, x = 'fontSize', d = document; p = d.getElementsByClassName(m); c=p.length; [].forEach.call(p, function(a,b) { a.style[x] = (b/c*100)+'px';});
^ run it in the browser console
fun times
 
@rdlowrey I do agree with you, but I've seen a lot of ugly hacks to "fix" to get access to what they think they need. So protected isn't optimal, but private neither is imo
 
@webarto Why does it need a singleton? A: It doesn't. How to avoid it? A: Not using a singleton, and fixing your application's architecture
> Really, the best tip that I can give to ferret out architecture debt is that if you find yourself trying to solve a problem that's tricky with respect object relationships, your architecture is probably flawed. A good example is if you want to prevent child objects from making a protected method publicly visible. This is non-obvious, and isn't something you'd normally do. To me this triggers an instinct to look at why I need to solve this problem in the first place.
 
6:21 PM
@rlemon thanks for yet again a super handy feature!
 
ohh you are very welcome
makes blogs look fun (change messages to p and getByClass to getByTag)
 
user895378
@PeeHaa Well of course it's a situational issue. OOP is often as much art as science. But the fact that you've seen people hack up "solutions" because they don't know how to use composition doesn't change anything :)
 
hi, how can we tell to Mysql ( Is there any row, where $var1=value1 AND $var2=value2) Sort of the way we use && in 2 if conditions. I have tried SELECT count(*) FROM table` WHERE var1=value1 & var2=value2` Table has only one row. and PHPmyadmin shows that var2 field value is not same as value2. But query is always returning $num = $row["count(*)"] as 1 in a while($row = $login->fetch_assoc())`
 
I am trying this:
private function create_controller($controllerName) {

    //DB CONN
    $firstHandle = null;
    $secondHandle = null;
    //Primary db connection
    $database_info = $this->CONFIG->get('DB_INFO');
    if($database_info)  {
        $firstHandle = new MySQL($database_info['host'], $database_info['login'],
                               $database_info['password'], $database_info['database'], $this->CONFIG->get('DEBUG_QUERIES'));
    }
    else    {
        exit("DO NOT HAVE DB INFO SET");
    }
 
@Davinder did you try using AND like in your example :P
 
6:22 PM
but then in the controller class the 2 handles are NULL
Why does that happen?
 
user895378
I frequently make methods protected instead of private strictly for testability reasons.
 
@PeeHaa I had some ideas, but I always get confused with what should I do first: study all the patterns and a framework or just start coding and alwaus picking to information sources
 
public function __construct(SessionManager $SESSION, Config $CONFIG, MySQL $firstConnection = null, MySQL $secondConnection = null) {
    $this->CONFIG = $CONFIG;
    $this->pageOn = $this->CONFIG->get('page');
    $this->session = $SESSION;
    $model_name = $this->name;
    if(class_exists($model_name) && is_subclass_of($model_name, 'AppModel')){
        echo "<pre>_____<br/>"; var_dump($firstConnection); var_dump($secondConnection); echo "</pre>";
        /**  @var AppModel $this->$model_name */
 
what is new MySQL? do you have a MySQL class in your code?
 
user895378
You need seams in your code to test against, and if those seams are private it's difficult to mock them.
 
6:23 PM
@cHao Yes...
 
@rlemon yeah, i used where $var1=value1 AND $var2=value2 or am I doing it in a wrong way?
 
It var_dumps correctly in the create_controller fn
 
@rdlowrey Not impossible though, but you need an ugly hack ;)
 
@rdlowrey Although I did encounter a situation yesterday where I wanted something to be private instead of protected. Let me see if I can find it.
 
object(MySQL)#6 (17) {
  ["affected_rows"]=>
  int(0)
  ["client_info"]=>
  string(50) "mysqlnd 5.0.8-dev - 20102224 - $Revision: 308673 $"
  ["client_version"]=>
  int(50008)
  ["connect_errno"]=>
  int(0)
  ["connect_error"]=>
  NULL
  ["errno"]=>
  int(0)
  ["error"]=>
  string(0) ""
  ["field_count"]=>
  int(0)
  ["host_info"]=>
  string(21) "st-bodb-01 via TCP/IP"
  ["info"]=>
  NULL
  ["insert_id"]=>
  int(0)
  ["server_info"]=>
  string(11) "5.5.25a-log"
  ["server_version"]=>
  int(50525)
Thats var dump from the 2 places
 
6:24 PM
@ircmaxell thanks, it probably doesn't need, but what I got used singletons, it won't be an quick fix pokit.org/get/img/5559d2e53a33b0952d38b7d959ed399d.png but it is worth rewriting...
 
:-(
 
and the code isn't changed in any way but by adding the var_dump?
 
SELECT foo, bar FROM tableName WHERE parent_id = :sanitizedInput AND some_text like "%bar%" LIMIT 10
 
What is going on ? :-\
@cHao You see where the var_dump's are?
 
yeah. it doesn't work right with or without them?
 
6:26 PM
@rlemon Ok, do I need to use like even if I am doing full-length stringmatch( exact match)
 
@cHao right
I only added them to see what was going on.
 
not iirc @Davinder
 
@hookman I used to just like to dive in head first and come to the conclusion that I suck. And learn from my mistakes. But lately I just think things through before doing anything. I can just stare at my screen without writing any code to try to come up with a solution for things which aren't a problem ATM. And still my code will suck, but it's sooo much easier to refactor it
 
just remember to sanitize your inputs before passing them to SQL
 
user895378
@LeviMorrison Oh I'm definitely a private over protected person, but sometimes I will make a method protected in the interest of testability. I'd rather be able to mock something easily for testing than have to go through the ringer of reflection + setAccessible just to test a method whose privacy relative to child classes isn't terribly significant.
 
6:28 PM
:-\
 
@rlemon so, my query will be SELECT * FROM tableName WHERE parent_id = :sanitizedInput AND var2 = value2 LIMIT 10 ??
 
@rdlowrey I'm a protected over private person. I basically use private for functions which are part of larger algorithms where it wouldn't make any sense to expose that functionality to a subclass.
 
and that constructor is for...what, your controller class?
 
where, var2 & parent_id are col names
 
user895378
@LeviMorrison I agree with that usage though. Perhaps private over protected was the wrong way to describe my feelings.
 
user895378
6:30 PM
I think a lot of people automatically disregard private altogether, though, because they think "I don't want to limit what someone can use this for through extension."
 
@Davinder sure
 
user895378
But some things shouldn't be exposed for extension.
 
user895378
And often composition is better than inheritance anyway, so the extension argument is a moot point.
 
user895378
often, but not always (note the emphasis)
 
I think I fixed it...
 
6:32 PM
@PeeHaa I have 3 small projects delivered about a month ago. Customers were satisfied, me too. Now: customers - same, me - I want to rewrite this and that.......
want to rewrite about a half*
 
@hookman When in corporate environment: don't change it unless payed and learn from it for future projects. When in personal environment: change it at will :)
 
user895378
Is anyone using PHPUnit 3.7? Are there any notable changes from 3.6?
 
Almost done switching over to Dependency Injection for the db handlers.
 
@Neal why did you link @gordon's post about mysqli?
 
@hookman that's normal. at some point you really just have to learn to say "good enough" and just fix whatever brokenness the customer sees (assuming you did the original code even semi decently)
 
6:36 PM
@PeeHaa eh? Oh. bc he ddnt suggest PDO
 
@Neal The question was: "Switch to mysqli or stay with mysql?"
:P
beer or whiskey? -> I like cake!
you see :)
 
@rdlowrey i looked at 3.7...the code to generate skeleton tests had changed quite a bit when i was looking at it
 
@PeeHaa :-P still. even when someone asks a question with mysql_* I always suggest mysqli or PDO
 
to the point of being incompatible with how i do stuff
 
@rdlowrey I'm waiting for some positive reviews ;)
 
6:38 PM
blah
 
Anyone know of a good code-generator API?
 
what are you generating code for?
 
Like if I wanted to generate model-classes from existing db tables - I'm not asking about how to describe the tables and all that.. just an API that helps generate the PHP class code. Just something to scaffold out models
 
@ircmaxell I always have troubles interpreting those blahs and blehs of yours :P
 
blah
 
6:41 PM
sigh
 
Now you are just messing with my mind
 
blörpsi
 
:-)
 
ze german
 
I've used CakePHP's and Zend_Tool in the past
 
6:41 PM
and you try to forget the past
@Neal continue;
@MikeB so you are looking for something new, correct?
 
New, mainstream, up-and-coming - any of that :)
 
@PeeHaa That's why i asked the best practice of accessing config from a function. I think that the procedural style for DI is passing $config['whatyouneed'] as a parameter. There is no sense to make a single class in the whole procedural app.
 
@MikeB sorry, I'm probably 2-3 years behind :)
 
Hrm, thought of a new blog post for Friday...
 
it's Friday, Friday? :)
gotta write blog post on Friday
what is the topic you are going to cover?
 
6:46 PM
@MikeB , yeah , we usually use SO for that , you input the project requirements, and it spits out some code
 
read it on Friday :-P
 
@cHao If I completely rewrote something and made it a way easier to suppurt and extend, I just suggest it to the customers free of charge. Anyway when they need to add something, most probably they'll contact me.
 
@webarto continue what?
 
@tereško SO = StackOverflow? Crowd sourcing? :p
Where's my tag
 
6:48 PM
yes
 
haha
 
@Neal sorry for pinging you, that thing we tried today and @deceze screwed us :P
 
I'm running a fever and just wrote this really long post.. I feel as if I wrote something wrong somewhere but cannot really tell what it is. Anyone that could give me some feedback?
0
A: image bandwidth usage

refpSure there methods, some can be trusted more than others. Using Referer-Header There is a HTTP-Header named Referer which most often contain a string representing the URL which a user visited to get access to the current request. You can see it as a "I came from here"-header. If it was guar...

 
@webarto lol
@tereško I updated my code. It now uses Dep Injection.
 
I am going to start learning PHP independently, what are some of the best resources to use?
aside from stack, I was asking more towards books and such
 
6:52 PM
@Neal , here is what i find strange about that code : why would controller need a database connection ?
 
@tereško it doesn't. but the controller creates the model.
 
if an object requires another instance just so it can pass it along, then you are violating Law of Demeter
you really need to watch that lecture
and also this one , which explicitly focuses on dependency injection :
 
@JohnnyB The best way to be good at PHP is to be good at programming in general.
@JohnnyB Books like Code Complete and Clean Code are recommended.
 
@tereško So how would all models get the db info? if the controller creates the 1st model, and the 1st model creates all using models?
 
@PeeHaa If I completely rewrote something and made it a way easier to suppurt and extend, I just suggest it to the customers free of charge. Anyway when they need to add something, most probably they'll contact me.
 
6:59 PM
@LeviMorrison thanks I will check that out. My programming is mediocre, I have been reading and practicing coding more to try and improve my skillset
 
@hookman Free of charge sounds like a broken business model
 
@Neal no , first you have to understand that what you call "models" might require more the a DB connection. Quite often you will need access to cache too
controller should just require a "model factory" (as you would call it)
 
@tereško ehhh. ok. So what do I need to do?
 
this factory you hold the DB connection ( which it creates when first "model is build )
 
Anyone up for a challenge?
 
7:02 PM
is websocket implementation changed recently in FF/Chrome (recently = last 15 days), is there a way to find out...
 
Let's say I have a map
 
continue
 
On that map, I have several dozen points of pickup (let's call them Stations)
 
@PeeHaa for them nothing is changed, for me - easier extending. Anyway I have time to rewrite rarely, but I still had a couple of projects rewritten.
 
@Neal , you need to watch the damned lectures .. then you will at least know what is the point of it all
 
7:03 PM
A Client may ask to be picked up at one Station and be taken to another Station
There can be a multitude of clients
Requests from Clients come at realtime
The point is to give the pickup vehicle an updated route at realtime to drive through
 
@tereško :-( I can't now .... Can you email me the links?
 
It should be the most efficient, resulting in the lowest average time for Clients to reach their Stations.
So as I said, anyone up for a challenge? :P
 
@Neal , chat history is searchable
 
@Truth brainf* :)
 
@hookman see, now, that's just crazy talk. unless you actually need to do something to it, it's obviously good enough to get the job done. why are you going to waste time rewriting it, when 6 months from now you're just gonna want to do it again?
 
7:07 PM
@webarto :P
 
@tereško is it now?
 
and for FREE too? screw that.
 
@Neal It is
Dec 17 '11 at 9:51, by tereško
@fluty : http://www.youtube.com/watch?v=-FRm3VPhseI and http://www.youtube.com/watch?v=RlfLCWKxHJ0
In ten seconds
30k user, this has less to do with your lack of PHP knowledge now is it?
 
strange issue I'm facing, cookies are not sent in headers when request originated from subdomain... pokit.org/get/img/81dc22dfecf7800abfed271af0629bd0.png
 
7:09 PM
@tereško Fancy
 
@cHao sorry, wrong autocomplete :) I don't know why, I always want to make the code more beautifull, flexible, extendable... )
 
@hookman yeah. that's your inner architecture astronaut trying to take over. don't let him. there's such a thing as "good enough", and if you don't wanna spend the rest of your life rewriting your code, you need to learn to recognize it. :)
 
<-- idiot, same origin policy
@ircmaxell I'm happy to announce that I removed singleton entirely and waiting for some hidden feature to fail :)
 
@cHao I still have a lot of thing to study to write good enough code ^)
 
So... Anyone up for my challenge?
I'm looking for a way to approach the problem
Not in any specific language
 
7:18 PM
@hookman if it gets the job done, and you don't have to decipher it in order to make some tiny change, then it's good enough for now. :) we all (well, those of us that care about our work) have that little voice in our heads telling us we could have done it better...and if we'd known then what we know now, yeah, we could. but the day after you rewrite the whole thing, that voice is gonna be like "you know, we shoulda done this differently..."
sometimes even while you're rewriting
 
What's your challenge @Truth?
 
@Truth Use jquery
 
15 mins ago, by Truth
Let's say I have a map
Read down from there :)
@MikeB Too bad I can't upvote comments without littering the starred field :D
 
@cHao do you mind me to print and stick this to the monitor? :)
 
@Truth that's definitely a challenge..
 
7:19 PM
go for it :)
 
@Justin heh
 
Trying to wrap my head around something MUCH easier atm... don't think i'll be attempting your challenge lol
 
@PeeHaa Shame on you! Your website about page links to #!
 
@Truth I guess the obvious answer is for the vehicles to poll some service for new instructions
i.e. A driver checks their cell-phone every few minutes for a new route
 
@MikeB I'm actually focusing more about the routing algorithm itself
 
7:22 PM
But checking their cell-phone (polling) is probably expensive
derp
 
It's not your normal node-to-node route
Also, I'm planning on a fluent socket connectionh
 
Like Dijkstra's algo? Or some other path-finding logic?
 
user895378
SWEET! I had no idea PHPUnit had logical bitwise constraints. I've been splitting what should be a single test function into two because the PHPUnit documentation sucks.
 
Most documentation does..
 
user895378
$mock = $this->getMock('MyClass');
$mock->expects($this->exactly(2))
         ->method('doSomething')
         ->with($this->logicalOr('A', 'B'));
 
7:26 PM
Icecream & House M.D. Love it :)
 
user895378
The mocking api is pretty nice if you can get pass the stupid method chaining and unhelpful documentation ...
 
@NikiC @ircmaxell Do we know of anyone who is really fluent in the parsing/lexing portion of the PHP source?
 
@LeviMorrison Ask ahead
 
I mean, if we want a new parser for PHP 6.0, it's not going to materialize out of nowhere.
Someone who really knows the system could point out its flaws much better than I can.
 
Ah that oyu mean
Well, I am good at pointing out flaws :D I like to complain
 
7:29 PM
hmm ... i want to collect 200 today
 
@LeviMorrison But what do you need parser complaints for?
 
@hookman work in progress :-)
 
@NikiC To not repeat the mistake.
 
@LeviMorrison Not sure what you mean
 
@PeeHaa ;) Was hoping to find follow me on Twitter button
 
7:32 PM
@NikiC Let's say that you, @ircmaxell, and I put our efforts together to make a new parser. If we know the specific complaints of the current parser we can avoid that mistake in our parser, yes?
 
@LeviMorrison Ah, yes
 
What HTML parsing library do you prefer?
 
Well I know the parser pretty well. I can point you to the main problem spots.
The main issue is the variable / function call parsing
You need to spend several hours to fully understand that part of the grammar
 
@hookman Whenever I've need to parse HTML I've always used DomDocument
 
And (as I already mentioned a few times before) the whole issue stems from the fact that PHP chose some strange semantics for $$foo[0]. If that would be parsed as ${$foo}[0] instead of ${$foo[0]} one could clean up the grammar a lot. At least I think so
 
7:34 PM
hey guys about to list my site on google wondering if any have tips for obfuscating sql connection code, im using a PDO connection file that is in a directory that denies HTTP access and the most htat appears on a page is $dbh = db_connect (); and $dbh = null;
 
@ert3 Just make sure it has .php extension, is outside of the document root and errors aren't displayed but logged
 
@NikiC Could you give me the overview of how PHP is lexed and parsed?
 
ok thats something i've been needing to address, error logs, i need to make a script to write them, thanks for reminding me
 
@LeviMorrison Sure
 
@ert3 ? make a script to log errors?
 
7:37 PM
@ert3 error_log?
 
@PeeHaa my host doesn't give me easy access to them so i need to make my own error.txt and give it a home
 
@NikiC Want to go to another room? This one seems to be a bit busy.
 
@ert3 What's the point of having logs than? :P
 
@LeviMorrison nah
 
@LeviMorrison Is it a private room? I'm actually interested in this as well
 
7:38 PM
Okay.
 
Nevermind :P
 
@PeeHaa possible instrusion attempts, users who can't speak up about a problem because an error is stoping them
 
@LeviMorrison That sounded a bit gay ;)
 
user895378
lol
 
7:39 PM
 
@rdlowrey You're the local PHPUnit guru, right? I'm trying to figure this vfsstream stuff out. Namely how do I mock php://input
 
user895378
@GordonM I wouldn't go that far.
 
user895378
@edorian is the person I'd put at guru status.
 
@GordonM The local PHPUnit guru is actuall @edorian, but he hasn't been around lately :/
 
Also, making a fluid grid = 1.6 metric shitload of maths.
 
user895378
7:40 PM
@GordonM vfsStream is for mocking the file system ... not php://input
 
How would you mock that, then?
 
@LeviMorrison Yes, there are a few that hang out on IRC or on list that are really good with it...
 
So what the lexer does is take the input and generate tokens from it. For some tokens it additionally specifies an lval (lower value). This is done for tokens which have some kind of meaningful value like strings / integers
 
The class defines the path as const PATH = 'php://input' and then accesses it with static::PATH internally so I could subclass it and override where it points. The plan was to point PATH to a vfsstream deely. But really struggling to get to grips with the vfsstream docs
 
user895378
@GordonM I'm not sure how you could mock php://input itself. The best you could do is ask for the string you want directly in a method signature and put the accessing of php://input into a mockable seam method like this:
 
7:41 PM
The parser then calls the lexing routine and fetches one token at a time
And throws away any whitespace / comments tokens
The parser itself is defined in lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_parser.y and uses bison as the parser generator
In LALR(1) mode, so the grammar can use a maximum of one token lookahead
 
What happened to the good old days when you would just write code and took it on trust that it worked? I miss those days. Actually no I don't, because untested code sucks. But I wish there was a way to just mindlessly crank out unit tests (other than hiring an intern).
 
(That btw is also one of the reasons why we need strange hacks. If we wouldn't have them we'd have shift/reduce conflicts)
 
@NikiC It's important to note that "throws away comments" is a simplification, it actually stores them in some cases for use by things like reflection... (some cases, not all)...
 
@ircmaxell yeah, doc comments
Another thing is that the parser doesn't actually build up an AST
Instead it directly emits opcodes
 
@NikiC Improvement #1: build an AST.
 
7:45 PM
This is done by calling the various zend_do_*** functions in zend_compile.c
@LeviMorrison yes
If we build an AST though it might be reasonable to think more about integrating bytecode caching
 
@LeviMorrison that may not be an improvement. It would require an extra transform which could have a significant impact on performance (note could, just pointing out it's not a clear win)
 
because currently compiling a php script is blazingly fast (compared to other langs)
 
@GordonM there's a crazy trick you can use (told to me by @edorian actually), unregister the php stream wrapper, register your own which captures the calls, then restore the original one.
 
@ircmaxell But with an AST we could potentially improve performance as well. I
 
user895378
class PhpInputTester extends PHPUnit_Framework_TestCase {
    public function testNeedsInfoFromPhpInputDoesSomething() {
        $mock = $this->getMock('UsesPhpInput', array('retrievePhpInputData'));
        $mock->expects($this->once())
             ->method('retrievePhpInputData')
             ->will($this->returnValue('test'));

        $this->assertEquals('test--appended', $mock->needsInfoFromPhpUnit());
    }

}

class UsesPhpInput {
    public function needsInfoFromPhpInput() {
        return $this->retrievePhpInputData() . '--appended';
 
user895378
7:46 PM
@GordonM
 
They even say that you should mainly use a bytecode cache because it saves you stat calls, not because it saves you compilation ^^ But I never tested that claim
 
@LeviMorrison absolutely. Just pointing out it's not a clear win either way (doing it or not)
@NikiC bytecode cache? or opcode cache?
 
@LeviMorrison Maybe a bit
 
@ircmaxell Personally it's more of a violation of layers.
 
@ircmaxell Uh, opcode ^^ It's the same to me ^^
 
7:47 PM
@rdlowrey Permalinked, will look at it after I've finished calculating 5/9ths minus margins as a percentage. ;)
 
yeah, having the AST will probably not allow for any crazy optimization ;)
 
@NikiC Well, when you're talking about abstract parsers, they mean different things, no?
 
user895378
@GordonM yeah no problem. The point is to provide a seam in your code so that you can mock specific behavior to test the rest in isolation.
 
@NikiC Well, one it will potentially allow for is plugging into LLVM for a jit runner...
 
@ircmaxell In theory
 
7:48 PM
@GordonM but the best way to do this is to change the class to not use the constant and make the stream injectable, then $fh = fopen('php://temp'), pass in $fh, call the method, rewind($fh); $data = stream_get_contents($fh);
 
@rdlowrey Trying to build a truly elastic grid (columns all defined as percentages). It's fun. :)
 
user895378
@GordonM sounds terrible :)
 
I'm pretty new to developing languages (I've only written a Datalog interpreter), but directly calling the zend_do_* functions seems wrong.
Layers are all mixed together.
 
Maybe
It's a single-pass compiler as they call it ;)
 
@rdlowrey 83.0833333333335% is how wide a 5/6th column needs to be. Assuming 1.5% margins. :)
 
7:49 PM
@GordonM Isn't there a CSS option to make the entire box model fit within height and width?
 
Just thought you'd want to know
 
user895378
I'll log that away for future reference.
 
@GordonM box-sizing:border-box; ?
 
but in any case, having an AST would remove at least some of the quirks
 
@LeviMorrison I'm not saying that it's great. But generating an AST where one isn't needed will be nothing but a performance sink on compilation...
 
7:51 PM
Two things that come to mind:
 
if it's needed, and you can justify it, great
 
1. foo::$bar will currently emit a compiled variable for $bar, which just stays unused
 
@ircmaxell How's the good fight for getting stuff into PHP $nextVersion going?
 
2. ($foo) and $foo behave differently in various context
3. The ZE something fetched variables with BP_W instead of _R, even though it's not necessary but hard to change without AST
and stuff like that ;)
 
@GordonM you're watching it unfold here
@NikiC just stays unused?
 
7:53 PM
@ircmaxell Yes
 
oh, because of $bar instead of foo::$bar
 
exactly
 
you know what would be awesome, an editor with a cheat sheet box, just sits to the right of your code, maybe above whatever meeters your file structure, and then you can just copy and paste what you need to look at, jot down important variables, you know instead of making me buy a third monitor
 
@NikiC So are there any problems you see before we get to calling zend_do_*? Like, are the grammar definition and lexing portions okay?
 
Well, couldn't that be solved with either a multi-pass parser, or redefining the grammar better?
 
7:54 PM
Generally the direct opcode emission causes lots of limitations
@ircmaxell It would be solved by a multi-pass parser at least
@LeviMorrison The grammar is to some parts really horrible (as mentioned above)
And the lexer has (at least in one place) a parser dependency, so in that case it can't be used via the tokenizer ext :/ but that's just an edge case
 
(Also, do we have a BNF or EBNF grammar that's up-to-date?)
 
hrm... Actually, doing that, you could cache the AST instead of opcode, and have it be portable (build a distributed AST cache, instead of a local one)...
 
@LeviMorrison no
 
@LeviMorrison the current grammar isn't expressable in BNF IIRC
 
@ircmaxell not sure I see the benefit
 
7:56 PM
@ircmaxell That sounds awful.
 
think about it
 
No wonder language enthusiasts despise PHP.
 
D:
 
Imagine you had a farm of servers. Just push AST to each directly, they never need access to the source code.
 
@ircmaxell How does that help?
 
7:57 PM
plus you could do things like basic optimizations and function inlining...
@NikiC opcode is compile specific, ast should only be minor version specific
 
Btw, I think that PHP has a good amount of optimization potential, because of the type hints
Once we have scalar typehints large portions would actually get "statically" typed
 
@ircmaxell This kind of stuff is a bit out of my depth. Are we talking about some kind of JIT like all the cool javascript kids have these days?
 
well, compilable as static.... woah...
 
but it's still hard to optimize ^^
mainly due to stuff like autoloading
 
forget JIT. don't even parse that to opcode, just compile right at parse (to machine code)
 
7:58 PM
where you just don't know in advance what that type hint is for
but you could obviously solve that kind of problem with polymorphic inline caching
 
@ircmaxell What would need to change to express it in EBNF? I'm curious.
 

« first day (640 days earlier)      last day (4301 days later) »