Re: embedding languages in Perl 6

2005-04-21 Thread Michele Dondi
On Wed, 20 Apr 2005, [ISO-8859-2] BÁRTHÁZI András wrote: I'm just wondering, if the following would be possible with Perl 6 or not? XML $a=elemselemContent #1/elemelemContent #2/elem/elems; [snip] The ideas coming from Comega, the next version of CSharp(?). Here's an intro about it: Some time ago

-X's auto-(un)quoting?

2005-04-21 Thread Michele Dondi
Are the -X functions still going to be there? I definitely hope so! However, to come to the actual question, it has happened to me to have to do, in perl5 that is: perl -lne 's/^//;s/$//;print if -e' or (less often) perl -lne '$o=$_;s/^//;s/$//;print $o if -e' Ok: no much harm done (to my

Re: Unify cwd() [was: Re: $*CWD instead of chdir() and cwd()]

2005-04-21 Thread Johan Vromans
Chip Salzenberg [EMAIL PROTECTED] writes: According to Michael G Schwern: In the same way that we have open() not fopen, fdopen, freopen... we can choose the safest and most sensible technique for determining the cwd and use that. And there is more than one open. Perl does have

Re: [pugs]weird thing with say ++$

2005-04-21 Thread Paul Johnson
On Thu, Apr 21, 2005 at 04:32:41PM +0800, fayland wrote: It has been published at perl6.language, but have no reply. In perl v5.8.6 built for MSWin32-x86-multi-thread: my $i = 1; print $i++, ++$i; # 1 3 my $i = 1; print ++$i, $i++; # 3 2 in pugs: my $i = 1; say $i++, ++$i; # 1 3

default values for attributive parameters

2005-04-21 Thread Carl Franks
Are default values supported for attributive parameters in an argument list? I wish to convert these 2 subroutines to perl6: sub foo { my $self = shift; $self-{foo} = defined $_[0] ? shift : undef; } sub bar { my $self = shift; $self-{bar} = defined $_[0] ? shift : $DEFAULT; } Is

Re: default values for attributive parameters

2005-04-21 Thread Juerd
Carl Franks skribis 2005-04-21 11:29 (+0100): I wish to convert these 2 subroutines to perl6: sub foo { my $self = shift; $self-{foo} = defined $_[0] ? shift : undef; } sub bar { my $self = shift; $self-{bar} = defined $_[0] ? shift : $DEFAULT; } Is this correct? Those are weird

Re: Unify cwd() [was: Re: $*CWD instead of chdir() and cwd()]

2005-04-21 Thread Juerd
Johan Vromans skribis 2005-04-21 8:22 (+0200): This is exactly the point (I think) Schwern is trying to make. There is 'open', that will do most of the time. If a novice user asks how to open a file, you can say Well, just 'open $fh, $file'. If you want more than vanilla file access, there

Re: [pugs]weird thing with say ++$

2005-04-21 Thread Johan Vromans
Paul Johnson [EMAIL PROTECTED] writes: I think I understand the implementation details leading to each behaviour, but rather than saying which was right, I think I'd be quite happy to see Perl6 copy (the ideas behind) C's rules regarding sequence points and undefined behaviour. I'm not so

Re: [pugs]weird thing with say ++$

2005-04-21 Thread Nathan Gray
On Thu, Apr 21, 2005 at 11:45:27AM +0200, Paul Johnson wrote: On Thu, Apr 21, 2005 at 04:32:41PM +0800, fayland wrote: It has been published at perl6.language, but have no reply. In perl v5.8.6 built for MSWin32-x86-multi-thread: my $i = 1; print $i++, ++$i; # 1 3 my $i = 1;

Re: [pugs]weird thing with say ++$

2005-04-21 Thread Matthew Walton
On Thu, Apr 21, 2005 at 11:45:27AM +0200, Paul Johnson wrote: It certainly makes more sense to me that the answer would be 2 2. But however it ends up, so long as we know what the answer will be, we can utilize it effectively in our programs. The trick with this construct usually in C is

Re: Blocks, continuations and eval()

2005-04-21 Thread wolverian
On Tue, Apr 12, 2005 at 04:17:56AM -0700, Larry Wall wrote: We'll make continuations available in Perl for people who ask for them specially, but we're not going to leave them sitting out in the open where some poor benighted pilgrim might trip over them unawares. Sorry for replying so late,

Re: Blocks, continuations and eval()

2005-04-21 Thread Larry Wall
On Thu, Apr 21, 2005 at 04:30:07PM +0300, wolverian wrote: : On Tue, Apr 12, 2005 at 04:17:56AM -0700, Larry Wall wrote: : We'll make continuations available in Perl for people who ask for : them specially, but we're not going to leave them sitting out in the : open where some poor benighted

Re: -X's auto-(un)quoting?

2005-04-21 Thread Larry Wall
On Thu, Apr 21, 2005 at 10:18:17AM +0200, Michele Dondi wrote: : Are the -X functions still going to be there? I definitely hope so! Certainly. They're useful, and one of the things people love about Perl. In fact, we're enhancing them to be stackable, so you can say if -r -w -x $filename

Re: Blocks, continuations and eval()

2005-04-21 Thread Nigel Sandever
On Thu, 21 Apr 2005 08:36:28 -0700, [EMAIL PROTECTED] (Larry Wall) wrote: Hmm, maybe that's not such a bad policy. I wonder what other dangerous modules we might have. Ada had UNCHECKED_TYPE_CONVERSION, for instance. How about use RE_EVAL; # or should that be REALLY_EVIL? Larry

Re: alarm() and later()

2005-04-21 Thread Brent 'Dax' Royal-Gordon
Larry Wall [EMAIL PROTECTED] wrote: Assuming we rehuffmanize kill to sendsignal or some such, we have: signal is a verb as well as a noun. sub alarm ($secs) { { signal $*PID, Signal::ALARM }.cue(:delay($secs)); } It even reads pretty nicely: signal 4242. -- Brent 'Dax'

Re: alarm() and later()

2005-04-21 Thread Larry Wall
On Thu, Apr 21, 2005 at 01:51:36PM -0700, Brent 'Dax' Royal-Gordon wrote: : Larry Wall [EMAIL PROTECTED] wrote: : Assuming we : rehuffmanize kill to sendsignal or some such, we have: : : signal is a verb as well as a noun. : : sub alarm ($secs) { :{ signal $*PID, Signal::ALARM

Re: -X's auto-(un)quoting?

2005-04-21 Thread Larry Wall
On Thu, Apr 21, 2005 at 06:40:54PM +0200, Juerd wrote: : Larry Wall skribis 2005-04-21 8:54 (-0700): : if $filename ~~ -r -w -x {...} : : Just curious - would the following dwym? : : if (prefix:-r prefix:-w prefix:-x)($filename) { ... } It might do what you mean. Personally, I