Empty hash

2005-06-01 Thread Luke Palmer
Two questions: Should {} be an empty hash rather than an empty code? Why did we change { %hash } from making a shallow copy of a hash to the code that returns %hash? Luke

Re: construction clarification

2005-06-01 Thread Carl Franks
It's *a* correct way. But redundant in this particular case. The universal new() would handle the one-argument call exactly the same as your overloaded new() does. Presumably, however, the one-argument variant would do something else as well. Some people will need to call the constructor with

Re: reduce metaoperator on an empty list

2005-06-01 Thread Deborah Pickett
On Wed, 1 Jun 2005 13.19, Joe Gottman wrote: Juerd asked: 2+ args: interpolate specified operator 1 arg: return that arg 0 args: fail (i.e. thrown or unthrown exception depending on use fatal) Following this logic, does join( , @foo) with [EMAIL PROTECTED] being 0

Re: reduce metaoperator on an empty list

2005-06-01 Thread Luke Palmer
On 6/1/05, Deborah Pickett [EMAIL PROTECTED] wrote: I'm still in the camp of those wanting each operator to know its own identity value (perhaps in terms of a trait). The identity of multiplication (say) is always 1, after all, and it doesn't change depending on when you do multiplication in

Re: reduce metaoperator on an empty list

2005-06-01 Thread Damian Conway
Deborah Pickett wrote: You are going to see empty lists more often than you think in expressions like $product = [*] @array; and having to write that as $product = [*] 1, @array; just to protect against a common case doesn't exactly flaunt Perl's DWIMmery to me. I *have* to write 1 there,

Re: construction clarification

2005-06-01 Thread Carl Franks
The universal new() would handle the one-argument call exactly the same as your overloaded new() does. Is that correct? S12 says... All classes inherit a default new constructor from Object. It expects all arguments to be named parameters initializing attributes of the same name. ...

Re: reduce metaoperator on an empty list

2005-06-01 Thread Michele Dondi
On Wed, 1 Jun 2005, Luke Palmer wrote: $ordered = [] @array; If @array is empty, is $ordered supposed to be true or false? It certainly shouldn't be anything but those two, because is a boolean operator. I read that (mathematically) as for all i, for all j such that j-i=1, a_ia_j,

Re: construction clarification

2005-06-01 Thread Damian Conway
Carl Franks wrote: The universal new() would handle the one-argument call exactly the same as your overloaded new() does. Is that correct? S12 says... All classes inherit a default new constructor from Object. It expects all arguments to be named parameters initializing attributes of

Re: construction clarification

2005-06-01 Thread Damian Conway
Carl Franks wrote: However, if I allowed the default 'new' to handle that case, then the BUILD submethod has to be aware of that. I thought it would be cleaner to 'document' the special case with a seperate constructor, and also not require any special-case logic in the BUILD submethod. Is that

Re: reduce metaoperator on an empty list

2005-06-01 Thread Luke Palmer
On 6/1/05, Michele Dondi [EMAIL PROTECTED] wrote: On Wed, 1 Jun 2005, Luke Palmer wrote: $ordered = [] @array; If @array is empty, is $ordered supposed to be true or false? It certainly shouldn't be anything but those two, because is a boolean operator. I read that

Re: Unicode Operators cheatsheet, please!

2005-06-01 Thread Rob Kinyon
xOn 5/31/05, Sam Vilain [EMAIL PROTECTED] wrote: Rob Kinyon wrote: I would love to see a document (one per editor) that describes the Unicode characters in use and how to make them. The Set implementation in Pugs uses (at last count) 20 different Unicode characters as operators. I have

Re: reduce metaoperator on an empty list

2005-06-01 Thread BÁRTHÁZI András
Hi, You have to either supply an initial value or refactor your logic not to allow an empty @array (as in the first case). If you want it some other way, there are far too many special cases we have to work with, some of which are just mathematically impossible. I think `fail`ing is the best

Re: reduce metaoperator on an empty list

2005-06-01 Thread Michele Dondi
On Wed, 1 Jun 2005, Luke Palmer wrote: I read that (mathematically) as for all i, for all j such that j-i=1, a_ia_j, which is certainly satisfied by an empty list. Yep, it sure is. Now tell Perl to read it that way for any operator. Should _I_?!? ;-) I wonder what a logic-oriented

Re: date and time formatting

2005-06-01 Thread TSa (Thomas Sandlaß)
Sam Vilain wrote: I also don't like implicit normalisation to seconds underneath the hood when I'm doing basic date calculations, and the way that the DateTime base class is inherantly based on the Gregorian calendar. I concur in this view. From a typing point of view there should be some

Re: reduce metaoperator on an empty list

2005-06-01 Thread Dave Whipp
Luke Palmer wrote: For something like: $ordered = [] @array; If @array is empty, is $ordered supposed to be true or false? It certainly shouldn't be anything but those two, because is a boolean operator. I have no problem with 3-state logic systems (true, false, undef) if this is

Re: returns and context

2005-06-01 Thread TSa (Thomas Sandlaß)
Gaal Yahas wrote: How do I specify the signature of a context-sensitive function? sub foo() returns (what?) { return want ~~ Scalar ?? cheap_integer_result :: List_of_Sheep; } If it were two subs, one would is returns Int and the other List of Sheep. The draft S29 uses

My presentation on last weekend

2005-06-01 Thread BÁRTHÁZI András
Hi, I just would like to share it with you. We had a weekend at the lake Balaton on the last weekend, where I had a talk about Perl 6. The guys liked it (the girls had sunbath during the event :), and one of them (Poetro) said the summary: then we can say, that Perl 6 is an operator

Re: Transparent / Opaque references

2005-06-01 Thread TSa (Thomas Sandlaß)
Juerd wrote: Thomas Sandlass skribis 2005-05-28 17:34 (+0200): I propose %hash = { key = :\$variable, foo = 'bar' }; :\$variable looks like many things to me, but not an alias. Let's forget that idea, because I have a bunch of better ones! $hash = { key = \ $variable but rw , foo =

Re: reduce metaoperator on an empty list

2005-06-01 Thread Rob Kinyon
$ordered = [] @array; This is asking Is @array ordered? In the case of a 0-element or 1-element array, the answer is It is not disordered, which means $ordered is true. $ordered = ! [!] @array; Rob

Re: date and time formatting

2005-06-01 Thread Nathan Gray
On Wed, Jun 01, 2005 at 03:42:57PM +1200, Sam Vilain wrote: I've made a start on this. See ext/Date in pugs. I don't think that your views are necessarily contrary. That's what I'm looking for. Thank you! The biggest reason I didn't use DateTime was that I found it awkward for the common

Re: reduce metaoperator on an empty list

2005-06-01 Thread Deborah Pickett
On Wed, 1 Jun 2005 19.37, Damian Conway wrote: Deborah Pickett wrote: Someone please convince me otherwise. So what you want is not an identity value as default (which isn't even possible for many operators, as Luke pointed out), but a predictable failure value as default, so you can

Re: comprehensive list of perl6 rule tokens

2005-06-01 Thread Jeff 'japhy' Pinyan
Further woes, arguments, questions: In regards to @array, A5 says A leading @ matches like a bare array... but this is an over-generalization. A leading '@' merely indicates the rule is found in an array. @array[3] would be the same as $fourth_element_of_array, assuming those two values are

Re: comprehensive list of perl6 rule tokens

2005-06-01 Thread Patrick R. Michaud
On Thu, Jun 02, 2005 at 12:52:36AM -0400, Jeff 'japhy' Pinyan wrote: Further woes, arguments, questions: In regards to @array, A5 says A leading @ matches like a bare array... but this is an over-generalization. A leading '@' merely indicates the rule is found in an array. @array[3]