[Petal] New syntaxes
Jean-Michel Hiver
jhiver at mkdoc.com
Wed Jul 9 13:36:44 BST 2003
Just throwing ideas in the wild...
How about we could prefix variable names with their types to hint the
compiler?
Example:
%foo/bar # foo is a hash ref
@foo/0 # foo is an array ref
~foo/bar # foo is an object
foo/bar # unknown
It would ve quite easy for me to get Petal to just ignore those
syntaxical changes in its expression parser. We could maintain
compatibility with both systems (with added tests to the test suite)
until everybody feels that CodePerl is good enough to be merged back
into Petal.
As for passing arguments to functions, I would much rather see it
functionning with the following syntax, which is a natural extension of
the way things work at the moment:
--foo equates to "foo"
'foo' equates to 'foo'
foo equates to $hash->{foo} or something
$foo equates to $hash->{foo} or something
${foo} equates to $hash->{foo} or something
${foo/bar baz} equates to $hash->{foo}->bar ('baz')
etc.
Of course as you mentionned there is a problem with modifiers modifier,
but unfortunately that is unavoidable given the very flexible nature of
modifiers.
I suppose just like for the variables we could make modifiers accept the
syntax:
modifier:{blah blah blah}
but it complicates maters further so I'm not really sure that it would
be a good thing.
Cheers,
--
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
jhiver at mkdoc.com - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/
More information about the Petal
mailing list