Skip to content

Comment on PHP Is A Huskparent

Comments

hacking the procrast to be able to answer you...

The default scope is global, I did not say 'within a function'.

I know about the 'global' keyword, as does everybody else that has used PHP for more than 5 minutes.

If your language has a C like syntax and you have a default scope (which means that you can start executing code right from the first line without being in a function definition) then the default behaviour of a variable should be that it either does not exist inside a function (different scope) and throws an error or it should refer to the global variable.

To have a 'third option', which silently creates empty variables is very (no, make that extremely) poor design.

And no, I'm not telling how to break noprocrast :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.