Pierre Joye wrote on 09/02/2015 00:05:
On Mon, Feb 9, 2015 at 6:30 AM, Rowan Collins <rowan.coll...@gmail.com> wrote:
On 08/02/2015 20:33, Zeev Suraski wrote:
FWIW, while I think strict types - stricter than even strict languages -
don't belong in PHP, this syntax is clearly a step up from declare(),
which
was definitely not intended for this purpose.

I'm kind of intrigued what purpose it *was* intended for. I've always found
it a rather odd part of the language, but this seems as logical a use for it
as any.

For years, it had exactly one "execution directive", which worked in concert
with a runtime event handler (ticks=N + register_tick_function). In PHP 5.3,
a completely unrelated directive was added, to specify the encoding of the
file (something that more obviously has to be detected by the compiler).

Was there an original idea of what it would be used for that never came to
fruition? Or is there something I'm missing that connects "ticks" and
"encoding", but excludes "strict_types"?
Both are being done at compile time and modify how a file is compiled.
So no, I do not agree with "runtime" here, while one directive is
being used at runtime.

I didn't say it was runtime, I said it "worked in concert with" runtime code. My point was that declare(encoding) is something purely internal to the compiler, affecting how it parses the file, whereas declare(ticks) is using the compiler to change the actual execution of the code, which makes them feel very different in effect.

It's quite hard to generalise from those two examples to any real "vision" of declare()'s purpose, so I was genuinely curious what that vision was.

Regards,
--
Rowan Collins
[IMSoP]


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to