Re: Problem with dwimmery

2005-12-22 Thread Darren Duncan
At 7:42 AM + 12/22/05, Luke Palmer wrote: Recently, I believe we decided that {} should, as a special case, be an empty hash rather than a do-nothing code, because that's more common. However, what do we do about: while $x-- && some_condition($x) {} Here, while is being passed a hash,

Re: handling undef better

2005-12-22 Thread TSa
HaloO, Larry Wall wrote: And replying to the thread in general, I'm not in favor of stricter default rules on undef, because I want to preserve the fail-soft aspects of Perl 5. Also replying to the thread in general, I feel that undef as a language concept mixes too many usefull concept into a

Re: Problem with dwimmery

2005-12-22 Thread TSa
HaloO, Luke Palmer wrote: Recently, I believe we decided that {} should, as a special case, be an empty hash rather than a do-nothing code, because that's more common. Ups, is that distinction needed eagerly? Wouldn't the return value of a do-nothing code return a value that when coerced into

Re: Problem with dwimmery

2005-12-22 Thread Juerd
Luke Palmer skribis 2005-12-22 7:42 (+): > Recently, I believe we decided that {} should, as a special case, be > an empty hash rather than a do-nothing code, because that's more > common. I think it should be both. my $foo = {}; $foo(); # It was a sub my $foo = {}; $foo =

hashes and subs [was: "Re: Problem with dwimmery"]

2005-12-22 Thread Michele Dondi
On Thu, 22 Dec 2005, TSa wrote: Luke Palmer wrote: Recently, I believe we decided that {} should, as a special case, be an empty hash rather than a do-nothing code, because that's more common. Hmmm, OTOH a hash is a special kind of function, so it may also be convenient to think of { item

Re: Problem with dwimmery

2005-12-22 Thread Michele Dondi
On Thu, 22 Dec 2005, Juerd wrote: while $x-- && some_condition($x) {} Here, while is being passed a hash Why? Doesn't while's signature specifically prescribe a sub there, and if it does, then wouldn't it be just a bit too silly to stick to {} being a hash? Well, as hinted in my other ma

Structured data "format" [was: "Re: Problem with dwimmery"]

2005-12-22 Thread Michele Dondi
On Thu, 22 Dec 2005, Darren Duncan wrote: On a separate but related matter, I'm in the position of wanting to do something unusual, which is create a data file format whose content is executable perl code that defines a data structure, a hash of whatever. Kind of like how XML works except tha

Array/list transformations.

2005-12-22 Thread Michele Dondi
This is not a substantial issue regarding Perl 6, but is more a minor feature curiosity/meditation. It was inspired some time ago by this PM node: http://perlmonks.org/?node_id=509310 I was wondering if in addition to push(), pop() etc. there could be be rot() and roll() methods that would ac

Re: Problem with dwimmery

2005-12-22 Thread Austin Frank
Luke Palmer wrote: > However, what do we do about: > > while $x-- && some_condition($x) {} > > Here, while is being passed a hash, not a do-nothing code. Should we > force people to write: > > while $x-- && some_condition($x) {;} Do we still have a yada yada yada? Could it be used to d

Iterating over complex structures

2005-12-22 Thread Michele Dondi
In Perl 5 C is quite natural for iterating over lists and arrays. C is preferred for filehandles. With lazy evaluation this difference has been eliminated in Perl 6 so that while still TMTOWTDI (TAEMWTDI!) this kind of iterations will be more consistent. But in Perl 5 to "navigate" complex str

Re: Problem with dwimmery

2005-12-22 Thread TSa
HaloO, Juerd wrote: I think it should be both. So do I. my $foo = {}; $foo(); # It was a sub The postfix () is valid syntax irrespective of the former assignment, right? my $foo = {}; $foo = 1; # It was a hash Would you expect the second line to work witout the firs

Re: Array/list transformations.

2005-12-22 Thread Jonathan Scott Duff
On Thu, Dec 22, 2005 at 04:47:21PM +0100, Michele Dondi wrote: > This is not a substantial issue regarding Perl 6, but is more a minor > feature curiosity/meditation. It was inspired some time ago by this PM > node: > > http://perlmonks.org/?node_id=509310 > > I was wondering if in addition to

Re: Problem with dwimmery

2005-12-22 Thread Juerd
TSa skribis 2005-12-22 17:27 (+0100): > >$foo(); # It was a sub > The postfix () is valid syntax irrespective of the former > assignment, right? Valid syntax, sure, but it doesn't necessarily do something terribly useful. > > >my $foo = {}; > >$foo = 1; # It was a hash > Would you

Re: Structured data "format" [was: "Re: Problem with dwimmery"]

2005-12-22 Thread Darren Duncan
At 3:40 PM +0100 12/22/05, Michele Dondi wrote: On Thu, 22 Dec 2005, Darren Duncan wrote: On a separate but related matter, I'm in the position of wanting to do something unusual, which is create a data file format whose content is executable perl code that defines a data structure, a hash of

RE: Problem with dwimmery

2005-12-22 Thread Joe Gottman
> -Original Message- > From: Austin Frank [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 22, 2005 10:58 AM > To: Luke Palmer > Cc: perl6language, > Subject: Re: Problem with dwimmery > Do we still have a yada yada yada? Could it be used to differentiate > between the two cases? >

Problem with dwimmery

2005-12-22 Thread Jonathan Lang
Luke Palmer wrote: > Recently, I believe we decided that {} should, as a special case, be > an empty hash rather than a do-nothing code, because that's more > common. > > However, what do we do about: > >while $x-- && some_condition($x) {} > > Here, while is being passed a hash, not a do-nothin

Re: Problem with dwimmery

2005-12-22 Thread Nicholas Clark
On Thu, Dec 22, 2005 at 02:53:39PM +0100, TSa wrote: > HaloO, > > Luke Palmer wrote: > >Recently, I believe we decided that {} should, as a special case, be > >an empty hash rather than a do-nothing code, because that's more > >common. > > Ups, is that distinction needed eagerly? Wouldn't the ret

Re: handling undef better

2005-12-22 Thread Nicholas Clark
On Thu, Dec 22, 2005 at 02:00:49PM +0100, TSa wrote: > HaloO, > > Larry Wall wrote: > >but you do not want your rocket control software > >throwing unexpected exceptions just because one of your engine > >temperature sensors went haywire. That's a good way to lose a rocket. > > But then again y

Re: Iterating over complex structures

2005-12-22 Thread Luke Palmer
On 12/22/05, Michele Dondi > Please do not ask me what I have in mind, for I'm > not really sure. Well, @Larry has been researching attribute grammars for a month or two now, which are an efficient (programmer-wise, not necessarily processor-wise) method for specifying computations over trees. Th