class member declaration catalog

2008-08-11 Thread John M. Dlugosz
I just put together http://www.dlugosz.com/Perl6/web/class-declarators.html as 
part of my analysis and documentation effort.  I'll link the meanings to more 
extensive treatments.


Did I miss any *possible* combination?

--John


Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Aristotle Pagaltzis
* John M. Dlugosz [EMAIL PROTECTED] [2008-08-11 06:25]:
 I do agree that it may be better for multi-word identifiers
 than camel case or underscores, as seen in many other languages
 that the great unwashed masses have never heard of.

XML and the stack of related technologies also do this (in
particular, variables and functions in XPath), which is where
I first encountered identifiers with dashes. I have been wishing
I could have them in mainstream languages ever since.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/


Re: Closure vs Hash Parsing

2008-08-11 Thread Ron
On 10 Aug., 00:58, [EMAIL PROTECTED] (Patrick R. Michaud) wrote:
 On Fri, Aug 08, 2008 at 07:32:52AM +0200, Carl Mäsak wrote:
  Jonathan ():
   That this means the { $_ = uc $_; } above would end up composing a Hash
   object (unless the semicolon is meant to throw a spanner in the
   hash-composer works?) It says you can use sub to disambiguate, but

   %ret = map sub { $_ = uc $_; }, split , $text;

   Doesn't work since $_ isn't an automatic parameter for a sub, like it 
   would
   be in just a block (in the implementation, and if I understand correctly 
   in
   the spec too).

  Out of curiosity, would this work?

  %ret = map - { $_ = uc $_; }, split , $text;

 A pointy block with nothing after the arrow is a sub with zero params,
 so no, this wouldn't work.  One would need something like

     %reg = map - $_ { $_ = uc $_; }, split , $text;

  Or this?

  %ret = map { $^foo = uc $^foo; }, split , $text;

 I'm thinking S04 probably needs some clarification/updating here.
 Any block that contains a (placeholder) parameter probably needs
 to remain a sub, even if the block content is a comma-separated list
 starting with a pair/hash.

But then, what will happen to this:

%ret = map { { $^a = uc $^a } }, @arr;

I would expect that to be the same as

%ret = map - $a { my %h={ $a = uc $a }; %h }, @arr;

Regards,
Ron



Re: class member declaration catalog

2008-08-11 Thread John M. Dlugosz

Joe Gottman jgottman-at-carolina.rr.com |Perl 6| wrote:



  What happened to the let and temp declarators?

They are not declarators in the same sense as my/our.  They cause a 
run-time action to occur on existing variables.


--John


Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Mark J. Reed
I'm still somewhat ambivalent about this, myself.  My previous
experience with hyphens in identifiers is chiefly in languages that
don't generally have algebraic expressions, e.g. LISP, XML, so it will
take some getting used to in Perl.  But at least in Perl's case the
subtraction conflict is mitigated by the fact that many subtraction
expressions will involve sigils;  $x-$y can't possibly be a single
identifier.

And multi-word-expressions without hitting the shift key!  My RSI thanks you.

-- 
Mark J. Reed [EMAIL PROTECTED]


Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Bob Rogers
   From: Mark J. Reed [EMAIL PROTECTED]
   Date: Mon, 11 Aug 2008 09:07:33 -0400

   I'm still somewhat ambivalent about this, myself.  My previous
   experience with hyphens in identifiers is chiefly in languages that
   don't generally have algebraic expressions, e.g. LISP, XML, so it will
   take some getting used to in Perl . . .

Amen.  I've long since reprogrammed - to give _ if pressed once and
- if pressed twice, when editing languages with C-like identifiers.
So from my perspective, the added visual complexity is not worth it.

-- Bob Rogers
   http://rgrjr.dyndns.org/


Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Austin Hastings
That sounds cool. Did you do it at the editor level, or at the keyboard 
level?


=Austin

Bob Rogers wrote:

   From: Mark J. Reed [EMAIL PROTECTED]
   Date: Mon, 11 Aug 2008 09:07:33 -0400

   I'm still somewhat ambivalent about this, myself.  My previous
   experience with hyphens in identifiers is chiefly in languages that
   don't generally have algebraic expressions, e.g. LISP, XML, so it will
   take some getting used to in Perl . . .

Amen.  I've long since reprogrammed - to give _ if pressed once and
- if pressed twice, when editing languages with C-like identifiers.
So from my perspective, the added visual complexity is not worth it.

-- Bob Rogers
   http://rgrjr.dyndns.org/

  




Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Tom Christiansen
I'm still somewhat ambivalent about this, myself.  My previous
experience with hyphens in identifiers is chiefly in languages that
don't generally have algebraic expressions, e.g. LISP, XML, so it will
take some getting used to in Perl.  But at least in Perl's case the
subtraction conflict is mitigated by the fact that many subtraction
expressions will involve sigils;  $x-$y can't possibly be a single
identifier.

People use nonadic functions (nonary operators? where non = 0, not 9)
without parens, and get themselves into trouble for it.

% perl -E 'say time-time'
0

% perl -E 'say time-do{sleep 3; time}'
-3

% perl -E 'say time +5'
1218475824

% perl -E 'say time -5'
1218475817

% perl -E 'say time(-5)'
syntax error at -e line 1, near (-
Execution of -e aborted due to compilation errors.
Exit 19

--tom


RE: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Michael Mangelsdorf

Actually I can even imagine allowing almost all chars
in the middle of identifiers.

Is this a trend we should extrapolate into the lifetime scope
of the Perl 6 language?
How far are we in this process, given Unicode guillemets for hyper ops?

 
Kindly,
Michael

-Original Message-
From: TSa (Thomas Sandlaß) [mailto:[EMAIL PROTECTED] 
Sent: Montag, 11. August 2008 19:55
To: perl6-language@perl.org
Subject: Re: Allowing '-' in identifiers: what's the motivation?

On Monday, 11. August 2008 05:35:03 John M. Dlugosz wrote:
 E.g. see http://www.perlmonks.org/?node_id=703265 :

 sub bar {
  return 100;
 }
 sub foo { 50;}
 sub foo-bar {
return  rand(50);
}
 if (foo - bar != foo-bar) {
print Haha!\n;
 }

Actually I can even imagine allowing almost all chars
in the middle of identifiers. The price is that *all*
infix operators need spaces. This seems to be the trend
right now. See e.g. the disambiguation of meta reduce
and array constructors or adverbs versus nouns in the
call syntax.

So, how simple would a tokenizer become when whitespace
separates almost all tokens? Noteable exceptions would be
the pre- and postfix operators.


Regards, TSa.
-- 
The unavoidable price of reliability is simplicity -- C.A.R. Hoare
Simplicity does not precede complexity, but follows it. -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan



Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Bob Rogers
   From: Austin Hastings [EMAIL PROTECTED]
   Date: Mon, 11 Aug 2008 10:02:06 -0500

   That sounds cool. Did you do it at the editor level, or at the keyboard 
   level?

   =Austin

In Emacs; see rgr-c-electric-dash-mode in [1], or other similar
solutions in [2].  That way, I can turn it on for C and Perl (among
others), and off for Lisp and text.

   Of course, that's just the tip of the iceberg, but this is OT, so
I'll keep the Emacs evangelism off-list.  ;-}

-- Bob

[1]  https://rgrjr.dyndns.org/svn/rgr-hacks/trunk/rgr-c-hacks.el

[2]  E.g. http://www.emacswiki.org/cgi-bin/wiki/ElectricDotAndDash,
 http://svn.clouder.jp/repos/public/yaml-mode/trunk/yaml-mode.el


Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Darren Duncan

Mark J. Reed wrote:

On Mon, Aug 11, 2008 at 1:34 PM, Tom Christiansen [EMAIL PROTECTED] wrote:

People use nonadic functions (nonary operators? where non = 0, not 9)
without parens, and get themselves into trouble for it.


I believe the word you're looking for is 'nullary.


Alternately, the word is spelled niladic, which also has the advantage of 
looking like monadic, dyadic, etc. -- Darren Duncan


Re: Allowing '-' in identifiers: what's the motivation?

2008-08-11 Thread Aristotle Pagaltzis
* Michael Mangelsdorf [EMAIL PROTECTED] [2008-08-11 20:25]:
 Unicode guillemets for hyper ops?

Unicode? I don’t know about your ISO-8859-1, but mine has
guillemets. :-)

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/