://java.sun.com/docs/books/jls/third_edition/html/grammars.html
> > and writes a parser in Perl 6 for that grammar.
>
> Writing a Perl 6 grammar to parse BNF should not be too hard.
Writing a 5.10 regular expression to parse BNF shouldn't be too hard either.
Abigail
pgp0QsSS8lU00.pgp
Description: PGP signature
break a few programs.
I am fond of doing
local %_ = @_;
as one of the first statements of a subroutine. That, or
my %args = @_;
I like the latter because it uses a lexical variable, but I like the
former because %_ fits with @_ and $_.
Abigail
On Fri, Apr 12, 2002 at 02:14:36PM -0700, Erik Steven Harrison wrote:
>
> --
>
> On Fri, 12 Apr 2002 18:27:11
> abigail wrote:
> >On Fri, Apr 12, 2002 at 04:42:07PM +0100, Piers Cawley wrote:
> >> [EMAIL PROTECTED] writes:
> >> >
> >> &
semicolon.
You've got to be kidding. That makes the whitespace rules even more
insane; your program can behave quite differently wether there's a space,
a newline, or nothing between two tokens. Wonderful! People who tend
to use -e all the time (like me) will love it. (Not!) Pasting code into
IRC will be so much more fun.
I'll treasure my perl5 sources.
Abigail
> Case 2 will not print anything. The print is in the 'then' part
> >of the if.
>
> Correct.
>
> > Case 3 will be a syntax error - an if statement with a condition,
> >but not block.
>
> It won't be a syntax error *yet*. If there's a block immediately
> following then that will be treated as the 'then' block. If it's the
> end of file, or a nonblock, then it'll be a syntax error.
Did the code show anything following it? No? Well, then assume
it isn't there. ;-)
Next time I'll show this to someone, I'll add a semicolon.
Abigail
e's only
a clash if a format specifier is followed by a brace.
But the way perl6 is going, I doubt we'll see this kind of DWIM; perl6
is going more in the way of a bondage and discipline language.
Abigail
, I think in both cases, they should produce '3'.
Ah, more pointless changes with perl5.
I think I've seen enough of perl6 by now. I'll treasure my copy of perl5
till the end of times.
Abigail
not
everyone uses it.
> However, I think that:
>
> my $a, $b, $c;
>
> and
>
> my $a, $b, $c = @_;
>
> should work the same and they wouldn't do so if 'void' context was the only
> criteria used.
Both of the above my()s are in void context.
Also, if I have:
@a = (1 .. 10);
$a, $b, $c = @_;
$c becomes 10. Should $c become 3 when my is placed before $a?
Abigail
ot;bar");
then '(my $foo1, $bar1)' is in void context, while '(my $foo2, $bar2)'
isn't.
Do you really want them to behave differently?
> best way to shoot down my suggestion is an example where existing behaviour
> can't be determined from void/scalar/list context.
Will the above do?
Abigail
est renaming homonyms?
Requiring to write "eval {do FILE}" were you first wrote "do FILE;"
seems quite opposite to what he says.
Keeping the semantics but making it "include FILE" seems to be more
in the line what he means.
But then, it might be better to wait till Larry has spoken.
Abigail
s a fixed number of arguments, often consists
of non-alphanumerical characters and unlike what's labelled a function,
is often not prefix. But that's only syntactic sugar (and vinegar due
to precedence tables).
Abigail
change the behaviour of my:
GetOptions (foo => \my $foo,
bar => \my $bar);
tie my $shoe => $tring;
Abigail
%).
If my() would be an unary function, how come that
my ($foo, $bar);
makes $bar a lexical variable?
my just isn't a function. Just like return or while aren't, even when
followed by parenthesis. They are language constructs.
Abigail
etOptions (foo => \my $foo,
bar => \my $bar);
and
tie my $shoe => $tring;
are just way to practical to suddenly require more hoops.
Abigail
t; or 0, but
> will evaluate as true in a condition.
You mean the beaten-to-death ??, formely known as |||, operator?
It has torn p5p to shreds repeatedly.
Abigail
ar eval `cat FILE`;
If you take out the eval, you get:
scalar `cat FILE`;
which is pretty pointless.
I find a "let's require some extra hoops and red tape" not very-Perl like.
Perl is there for the programmer; not the other way around.
Abigail
h garbage collection,
DESTROY should still be called.
Being able to separate DESTROY and garbage collection is a feature. ;-)
Abigail
if there are other
references to it, but then, I don't see what an "object destruction"
is supposed to do if there are still references to the object left.
Nor is this wanted behaviour. All the programmer needs to do for
sooner resource disposal it to let his references go out of scope
when no longer needed.
Abigail
> The world is not not glibc. The world is not Linux.
> *end of minirant*
>
> Either I am being even more grumpier than usual or you people
> are making even less sense than usual :-)
*microrant*
The world is not schwern
*end of microrant*
Abigail
if needed.
Even after reading this twice, I still get the impression you think
both gcc and xfree86 would fit in the perl core snuggly.
Oh well, as long as you don't fit emacs in it; there's got to be some
limit.
Abigail
's more a data preserver than a garbage collector ;-)
Abigail
s belongs
[1] Only half-joking. I find it irritating I can't chain continue {}
blocks. [2]
[2] I guess this is in the same department as me wanting to 'last' out
of an if () {} else {} blocks, or to redo them.
Abigail
scalar()
> }
> continue {
> close F;
> }
>
> O.k., the example is a little bogus, what with IO::File etc.
> But for the general case...
We can do something like this already in perl5. There's even a module
on CPAN for it: "End".
use End;
{ my $foo = end {print "Leaving the block\n"};
...
last; # Prints "Leaving the block\n".
...
}
Abigail
ou named
> the return variable.
Eh, I don't think that bad memory, or a bad variable naming scheme
justifies this new feature.
If you forget how you name your variables you have much bigger problems
than to have to type 'return'.
Abigail
st context?
If so, what happens with:
sub some_sub {
@__ = qw /foo bar baz/;
}
my $fnord = some_sub;
If there isn't going to be a @__ of some sorts, how is the case of the sub
being called in list context going to be handled?
Abigail
:-)
>
> More like Fortran:
>REAL FUNCTION FOO(A)
>REAL A
> C
>FOO = 2*A+3
>RETURN
>END
> ^^^
> note exactly 7 spaces...
>
> And I think Fortran has a better claim to priority ;)
And then there's Parse::RecDescent
Abigail
e wouldn't be making perl6.
How does removing time() add something desirable?
Abigail
Perl slogan, and
now you are claiming this a *bad* thing? Oh my.
> If a change of mind when writing new software is too much a burden, then,
> I say it again, we should stick with perl5! As Jarkko always quotes:
> $jhi++; # http://www.iki.fi/jhi/
> # There is this special biologist word we use for 'stable'.
> # It is 'dead'. -- Jack Cohen
>
> If old code and old-code thinking are the only thing that prevents us to
> change time() or move it out of CORE, then I believe we should do it yes!
*blink*
Are you claiming the use of time() is dead? Or that stability is a bad
thing?
Abigail
t;
"No, it isn't!"
"Yes, it is; I never use it!"
"It should be in the core, I often use it!"
Abigail
fully, make it load faster.
I wouldn't say it's moving it out of the core on a language list.
That's just source code housekeeping.
Abigail
y core functionality
> > that makes any sense to pull out, and that only from an architectural
> > standpoint.
>
> Perhaps some of the more grossly UNIX specific things like getpwnam's
> extended family and the SysV IPC stuff?
But why? What is it going to buy you?
Abigail
ets really, really
> sticky.
I don't see this problem, unless you plan to write a filesystem in Perl.
Surely Perl asks the OS for l?stat() instead of keeping track of it itself?
Abigail
y interacts
with its environment, other programs and is eager to network with
the outside world. Seconds since 1970 might be as arbitrary as any
other measurement, but that's irrelevant. What's relevant is 30 years
of code that produces and expects timestamps in seconds since 1970.
Deprecating time() in favour of some other arbitrary measurement is
absurd. It might makes sense to have some other functions giving units
since some point in the past next to time() though.
Abigail
other operator is specialized internally as well?
$ perl -wle '%h = qw /foo bar baz qux/; map {s/.$//} %h; $, = " "; print %h'
foo ba baz qu
$
Abigail
at
> kind of signature it has, whether file Bar will be there, what kind of
> format it has, and so on, whether a feature Zog is present, or what
> is the value of parameter Blah. Just knowing the name of the platform
> doesn't buy you a whole lot.
You want both of course, if only to present the user an error message
(s)he can understand.
Abigail
s, while values HASH returns
aliases the values (new in 5.7).
I don't know why, perhaps so you could modify them easily:
for (values %hash) {s/foo/bar/}
just like you can do for arrays.
Abigail
outine). How does that work? I'd expect %hash to be fed to the
> subroutine as a list.
Aliasing again. They keys are copies, the values aliases.
Abigail
rguments (or $_ when called without),
it also has the right prototype and works on lists:
sub chop (@) {
my $__;
map {$__ = substr $_ => -1, 1, ""} @_ ? @_ : $_;
$__;
}
Aliasing is a cute thing.
Abigail
38 matches
Mail list logo