Sort of a rehash on an old topic, but there's new stuff now with A6.
Mike Lazarro had been making a list of all the operators that Perl6 has.
The latest version I could find was Take 6 (at
http://archive.develooper.com/[EMAIL PROTECTED]/msg12130.html).
So, my questions:
1. Is there a more recent
> > 2) (4, 1, 2) + 7 returns (9). This is C comma behavior, and I always
> >found it incredibly non-intuitive. I'd really like to get away
> >from this, even if it means that this expression is a fatal error
> >"Can't add scalar to list".
[...]
> Agreed, however, that (2) is icky. My
> Here are some of the answers from my own notes. These behaviors have
> all been confirmed on-list by the design team:
>
> An @array in list context returns a list of its elements
> An @array in scalar context returns a reference to itself (NOTE1)
> An @array in numeric (scalar) context retur
> But is it OK for a list to be silently promoted to an array when used
> as an array? So that all of the following would work, and not just 50%
> of them?
> (1..10).map {...}
> [1..10].map {...}
And somehow related to all this . . .
Let's assume for the moment that there's still a fun
> >While I like the glib "Arrays are variables that hold lists" explanation
> >that worked so well in Perl5, I think that Perl6 is introducing some
> >changes to this that make this less true.
> Like what?
Well, like the builtin switch statement, which was what I was trying to
show in my bad examp
> I'm trying, and failing, to accurately and definitively answer the
> question "what's the difference between an array and a list in Perl6?"
> If someone can come up with a simple but accurate definition, it would
> be helpful.
While I like the glib "Arrays are variables that hold lists" explan
> print "---" # must read the next line to
> # figure out if new line is statement terminator or not
>if $condition";
Yes, let's expand that example, and assume the "semicolons optional
where obvious" proposal.
sub foo
{
print "abcde"
if $condition
{
print "fghij"
}
}
> It would be trivial with a grammar munge to implement this (heck, I
> did it with a source filter in Perl 5). Surely CPAN6 (6PAN/CP6AN/??)
> will come out with one of these right off the bat, so you could do:
>
> use Grammar::ImplicitSemicolon;
>
> Or something like that, and be done with
> > I guess what I'm saying is that someone needs to provide a real-world,
> > non-contrived, example showing ??= in use.
> Fair enough. Real World, Non-Contrived: In all databases that I've ever
> worked with there are exactly two possible values for a boolean database
> field. Those two values
> SUMMARY
> C<$var ?= $x : $y> as a shortcut for C<$var = $var ? $x : $y>.
>
>
> DETAILS
> We have ||=, +=, -=, etc. These shortcuts (I'm sure there's some fancy
> linguistic term for them) save us a few keystrokes and clean up the code.
>
> So, concerning C, I find myself doing this type of th
> > Perhaps .size for number-of-elements and .length for length-of-string
> > would work?
>
> This would just cause them to Think About Things A Different But
> Equally Wrong Way: as assembly language objects whose SIZE in bytes is
> the determining component of their existence.
>
I am happy to
> On 2003-01-07 at 11:31:13, Mr. Nobody wrote:
> > .length is unneeded, since an array gives its length in numeric context, so
> > you can just say +@a.
> Unneeded, but harmless.
Getting off topic here (a bit), but I think it's a Mistake to have
.length mean different things on an array ["Number
Simon Cozens wrote:
> [EMAIL PROTECTED] (Deborah Ariel Pickett) writes:
> > That works, with one big proviso. You have to have predeclared all
> > possible methods in the class to which the object belongs, AND each
> > method in that class (and all defined subclasses)
> [EMAIL PROTECTED] (Damian Conway) writes:
> > But in Perl 6, the consistency between a method's parameter list and its
> > argument list *is* checked at run-time, so passing the wrong number of
> > arguments is (quite literally) fatal.
> But wait! If we can check how many parameters to pass, we k
Ah . . . one message with two things I wanted to talk about. Good.
Allison wrote:
> On Tue, Nov 19, 2002 at 01:24:30PM -0800, Austin Hastings wrote:
> > So what's wrong with:
> >
> > sub foo($param is topic //= $= // 5)# Shorter form with $=
> > sub foo($param is topic //= $CALLER::_ // 5)
> Supercomma!
> [snip]
> Larry then confessed that he was thinking of changing the declaration of
> parallel for loops from:
> for @a ; @b ; @c - $a ; $b ; $c {...}
> to something like:
> for parallel(@a, @b, @c) - $a, $b, $c {...}
Assuming that semicolon is no longer goi
Luke wrote:
> When junctions collapse, is that reflected back in the original
> junction, as it should be (QM-wise)?
>
> $foo = 1 | 2 | 4
> print $foo;
> # Foo is now just one of (1, 2, 4); i.e. not a junction
> [...]
Just a sanity check, but is this kind of behaviour something we sti
> > get guillemot
> Taken.
Extra credit for those of you who remembered that that's a bird, not a
punctuation mark.
--
Debbie Pickett http://www.csse.monash.edu.au/~debbiep [EMAIL PROTECTED]
"Is it, err, Mildred? O.K., no. How 'bout - Diana? Rachel?" "Ariel, her name is
> > On Thu, Oct 31, 2002 at 12:16:34PM +, [EMAIL PROTECTED] wrote:
> > > ... using backtick in vector operators ... A pair of backticks could
> > > be used if the vector-equals distinction is required:
> > > @a `+`= @b;
> > > @a `+=` @b;
> > Thats ugly, IMO.
> Oh, I wasn't claiming that it'
Damian wrote:
> (b) the symmetry of:
> Logical:&& || !!
> Bitwise:.& .| .!
> Superpositional: & | !
> is important...mnemonically, DWIMically, and aesthetically.
When I
> Again, it would be nice to be able to flag these to the compiler in a
> rule:
> rule thrice :count { <={.count < 4}> }
> / a? /
> Note that the C would cause the thrice count-rule to be matched
> non-greedily because the regex parser knows that it's a count, not a
> generic rule.
Going
> > The only extra piece of syntactic sugar that C is giving us over
> > C[*] is the ability to have arbitrary delimiters.
> Not quite arbitrary. Alphanumerics aren't allowed, nor are colon or
> parens.
Of course. I didn't want to poison my entire sentence with footnotes
for the obvious excepti
Note! Some of the following is hypothetical, not strictly based on Apocalypses
and such. Now that your brain is in the right mode:
Uri wrote:
> >>>>> "DAP" == Deborah Ariel Pickett <[EMAIL PROTECTED]> writes:
> DAP> C allows us to define both named a
Damian wrote:
> Debbie Pickett asked:
> > So my question is: why two words for regular expressions, but only one
> > for subroutines? Are "rule" and "rx" just alternate spellings, much as
> > Perl5's "for" and "foreach" are? If so, why the two keywords?
> > If not, why not?
> They are not quite
Sorry, I was being too terse in my original message, I guess some of the
meaning got lost.
When I said:
> > If %(...) makes a shallow copy of its innards, as Perl5's { ... } does,
> > then how do you impose hash context onto something without doing the
> > copy?
What I meant to say was:
> > Spea
> > Using %(...) to create a hashref, as { ... } does in Perl5, would go
> > against all that, because the purpose of making a hashref is to
> > *reference* something. Now a unary % operator/sigil/prefix might mean
> > referencing, or it might mean dereferencing, depending on whether the
> > symb
> I still have my vote on %() as a hash constructor in addition to {}. :)
The problem I see with that is that % as a prefix implies a
*dereferencing*, though years of Perl5 conditioning like this:
%{ $mumble } = return_a_hash();
print_hash( %{ $mumble } );
(Yes, the braces are optional; I'm
Back to this again . .
> > ..., and someone pointed out that it had a problem
> > with code like "{ some_function_returning_a_hash() }". Should it give a
> > closure? Or a hash ref? ...
> Oh, well now that it's stated this way... (something went wrong in my
> brain when I read the
[no longer sent to perl6-internals because it's not relevant there]
I see a problem . . whether the problem's with me or the grammar, that's
for you people to decide.
Do I read this part of the grammar correctly?
> sv_literal: /(?:\d+(?:\.\d+)?|\.\d+)(?:[Ee]-?\d+)?/
> | '{' h
29 matches
Mail list logo