Hello everybody,
I am new here (just reading for last couple of days), so firstly nice
to meet you:)
This discussion seems quite interesting for me and it would be nice
if I can join...
Sam Barrow napisal:
im not sure the following has been explicitly proposed, but how about
omitting the 'return' keyword and placing the return type hint before
the function identifier
function int a($b, $c) {}
This is, but I don't think this is possible, due to confusion with the
keywords (public, private, static, abstract, etc).
Parser should be able to handle it if the grammar is correct.
"something something2 somethign3 int foo(...)" works fine in some
languages.
LALR parser (Bison is used, isn't it?) is probably the most powerful
parser practically used, and certainly can handle such a set of
keywords correctly - even without "function" keyword (that makes
parsing way easier) - or maybe I have missed some piece of syntax
that might cause the problem (then my apologies)
As there is a person working on converting parser to Lemon, maybe it
would be wise to talk with him (her?), so the grammar is cleaned to
handle it.
Plus this leads to
long strings of keywords.
imho it is shorter - one keyword less. Actually it is also less
confusing for me - maybe because I am using C/C++ and Java a lot
where the syntax is equivalent. And if syntax is strict - i.e.
modifiers first, then returned type - is quite well-readable - name
of the function in the end, returned type just before.
The version with "returns" seems to me like "throws" phrase from e.g.
Java. Btw there was already such a solution in Pascal, but instead of
"returns" colon was used:
function foo(...):integer begin
...
end
Cheers,
Michal Dziemianko
PS. The idea is great anyways - I was always thinking why it is not
implemented:))
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php