Re: Synopsis 26

2007-03-19 Thread Damian Conway

Thom Boyer wrote:

I never could find the Pod-to-XHTML'd version of S26 -- the document 
attached to that email was S26.pod6, not S26.xhtml.


Attached.


I don't want to bug Damian, because obviously he has enough of life 
happening, as it were.


More than enough! Thank-you all for understanding that.

I'm hoping to get a run at finishing the Pod6 parser (in between crises), but 
don't hold your breath. :-(


Damian


Enhanced enumerations

2007-03-19 Thread Jonathan Lang

Some (many?) enumerations represent cycles, where incrementing from
the last element takes you back to the first: the seasons, the months,
the days of the week, the hues, etc.  How hard would it be to write a
module that lets you say something like:

 enum weekdays is cycle Sun Mon Tue Wed Thu Fri Sat

So that Sat++ eqv Sun (and a resumable control exception is thrown so
that you can do something fancy whenever you return to the start of
the cycle)?


Likewise, how would one be able to legally say:

 enum seasons spring summer autumn|fall winter

That is, to use a junction in the definition in order to provide
synonyms for one of the enumerated values?

--
Jonathan Dataweaver Lang


Re: Enhanced enumerations

2007-03-19 Thread Andy Armstrong

On 19 Mar 2007, at 21:31, Jonathan Lang wrote:


Some (many?) enumerations represent cycles, where incrementing from
the last element takes you back to the first: the seasons, the months,
the days of the week, the hues, etc.  How hard would it be to write a
module that lets you say something like:

 enum weekdays is cycle Sun Mon Tue Wed Thu Fri Sat

So that Sat++ eqv Sun (and a resumable control exception is thrown so
that you can do something fancy whenever you return to the start of
the cycle)?


Another way of looking at that enum is as a simple state machine.  
More complex state machines would be nice too. That is all :)


--
Andy Armstrong, hexten.net



Re: request new Mapping|Hash operators

2007-03-19 Thread David Green

On 3/18/07, Darren Duncan wrote:

On Sun, 18 Mar 2007, Aaron Crane wrote:
  That's easy even in Perl 5.  This modifies %hash in-place:
my @values = delete @[EMAIL PROTECTED];
@[EMAIL PROTECTED] = @values;

 [...]


If %hash contained keys a,b,c and @old_names was a and @new_names 
was b, then the above code would overwrite the existing b element, 
and leave 2 elements total.  The operation I proposed needs to fail 
when one requests a colliding element, such as that situation; [...]


Yes, and more than that, deleting an old key and adding a new one 
isn't strictly the same as renaming a key.  Consider what would 
happen if the value were a funny object that had side-effects every 
time you evaluated it.


As for the name, I don't think it's a problem for hashes and IOs to 
both have rename methods, but I do like Uri's rekey suggestion.



-David