[RFC] Perl Operator List, TAKE 6

2002-11-01 Thread Michael Lazzaro
Adjusted for the most recent notes: includes «op» as the preferred (and 
possibly only) spelling of "vectorize".  Everything but a few hyperop 
issues appears to be close to final, by my count: if/when Larry sticks 
a fork() in it, it's done.

hyperoperators:

  «op»  - When used with any unary or binary operator,
   "vectorizes" the operator.
  »op«  - [maybe] same, but intersection instead of union.
  ^[op] - [maybe] synonym for «op»
- [maybe] synonym for »op«

unary (prefix) operators:

  \ - reference to
  * - list flattening
  ? - force to bool context
  ! - force to bool context, negate
  not   - force to bool context, negate
  + - force to numeric context
  - - force to numeric context, negate
  ~ - force to string context
  ^ - complement, type-specific
  . - method call on current topic
  .=- method call on current topic, replaces topic

  ++- preincrement
  --- predecrement

unary and other postfix operators:

  These are used as postfix operators when encountered where
  an operator is expected.  No space is allowed between these
  postfixes and the elements they are operating on.

  ++- postincrement
  --- postdecrement

  ...   - synonym for ..Inf

  ()- method call
  []- array access
  {}- hash access


binary operators:

  <  > <=>===!=<=>- comparision (numeric)
  lt gtlegeeqnecmp- comparision (string)

  + - * / % **- arithmetic
  +=-=*=/=%=**=

  ~ ~=  - string concat
  x x=  - string repetition
  xxxx= - list replication

  &&||^^//  - boolean operations
  &&=   ||=   ^^=   //=
  and   orxor   err

  +&+|+^<<>>- bitwise (integer) operations
  +&=   +|=   +^=   <<=   >>=

  ~&~|~^- charwise (string) operations
  ~&=   ~|=   ~^=

  ?&?|?^- C-like boolean operations
  ?&=   ?|=   ?^=   - (result is always just 1 or 0)

  & | ^ - superpositional operations
  &=|=^=- conjunctive, disjunctive, exclusive
  all   any   one   none- conj, disj, excl, dismissive

  ~~  !~- smart match, smart non-match

  =>- pair creator
  , - list creator
  ; - "greater comma", list-of-lists creator
  : - adverbial
  . - method call

   ..   - range
  ^..   - [maybe] range, exclusive of endpoint(s)
   ..^
  ^..^

  =- assignment
  :=   - runtime binding
  ::=  - compiletime binding


trinary operator:

  ?? ::- if/else


parens, misc, and quotelike operators:

  These may appear where a term is expected.

  ()
  []
  {}

  m//   - shorthand, "matches"
  s///  - shorthand, "substitute"
  tr/// - shorthand, "transliterate"

  '...'  "..."   `...`   /.../
q qq  qx  rx  qw [qm?]

  <...>- iteration
  (heredocs)   - [exact format unknown; probably as perl5]


magical whitespace modifier:

  _ - When used at the end of a line or between
  statement elements, acts to "remove" whitespace
  when interpreting the statement.  (Allows
  whitespace to appear without invoking any
  special interpretations normally associated
  with that whitespace.)


named unary (prefix) operators, terms, and other
important assorteds, identified when possible:

  -X   - [op] filetest operators

  ref  - [op]
  exists   - [op]
  delete   - [op]
  defined  - [op]
  undef- [op]
  undef- [term]
  temp - [op]
  let  - [op]
  but  - [op] val properties

  ${ } - [deref] dereference scalarref
  @{ } - [deref]
  %{ } - [deref]
  &{ } - [deref]

  ...  - [term] yada**3
  Inf  - [term]
  NaN  - [term]

  is   - [declar] var properties
  ->   - [declar] like 'sub'
  hash - [declar] force hash context


MikeL


[RFC] Perl Operator List, TAKE 6

2002-11-01 Thread fearcadi
Michael Lazzaro writes:

 > magical whitespace modifier:
 > 
 >_ - When used at the end of a line or between
 >statement elements, acts to "remove" whitespace
 >when interpreting the statement.  (Allows
 >whitespace to appear without invoking any
 >special interpretations normally associated
 >with that whitespace.)
 > 

my understanding from the discussions was that 
"free"  ( separated by spases ) _ is still placeholder . and it
becomes "spaceeater" only when "attached" to operator . And a special
rule for block ending curly "}_" .  

_ - "spaceeater" modifier 
 Generally , no space is allowed between term and postfix
 operator.  to relax that rule use the "spaceeater"-prefixed form
 _op of the operator. e.g.  @a[1] is same as @a _[1] .  Binary
 operator is allowed to have no space before it if there is no
 postfix operator of the same name.  Terms like {code} , {hash} ,
 [array] have to have space before them if stand after term. 
 

 or 


 Any postfix operator op can be used in the form _op. that allows
 whitespace to appear between term and operator without invoking
 any special interpretations normally associated with that
 whitespace.  

 

arcadi 



Re: [RFC] Perl Operator List, TAKE 6

2002-11-01 Thread David Wheeler
On Friday, November 1, 2002, at 12:21  PM, Michael Lazzaro wrote:


  ^[op] - [maybe] synonym for «op»
- [maybe] synonym for »op«


I think that would be:

  `<> - synonym for «op»
  `>>op<< - synonym for »op«

Unless I misunderstood Larry's post, in which case it might be:

  `<>` - synonym for «op»
  `>>op<<` - synonym for »op«

Regards,

David
--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]




Re: [RFC] Perl Operator List, TAKE 6

2002-11-01 Thread Richard Proctor
On Fri 01 Nov, Michael Lazzaro wrote:
> 
>(heredocs)   - [exact format unknown; probably as perl5]
> 

There are comments by Larry in Appo 2 wrt RFCs 111 and 162.

Appo 2:
===

111  aaa  Here Docs Terminators (Was Whitespace and Here Docs)
162  abb  Heredoc Contents

RFC 111: Here Docs Terminators (Was Whitespace and Here Docs)
Fine.

RFC 162: Heredoc contents
I think I like option (e) the best: remove whitespace equivalent to the
terminator.

By default, if it has to dwim, it should dwim assuming that hard tabs
are 8 spaces wide.  This should not generally pose a problem, since
most of the time the tabbing will be consistent throughout anyway, and
no dwimming will be necessary.  This puts the onus on people using
nonstandard tabs to make sure they're consistent so that Perl doesn't
have to guess.

Any additional mangling can easily be accomplished by a user-defined
operator.

RFC111:
===

Perl6 should ignore any whitespace before the terminator of a heredoc on any
line.  Further it should ignore any whitespace ";"s (and comments) that
follow the terminator.  Perl should also ignore whitespace between the << and
the terminator.  

Discussion took place on allowing statements following the terminator, but
generally these where thought of as a bad idea.  So only ";" and comments
should occour on the same line.

  All of these should work:
  
  print 

Re: [RFC] Perl Operator List, TAKE 6

2002-11-01 Thread John Williams
On Fri, 1 Nov 2002, Michael Lazzaro wrote:

>...   - synonym for ..Inf

Did I miss the report of the bistable ... operator's death?
I've looked around, but I can't seem to find it.

~ John Williams





RE: [RFC] Perl Operator List, TAKE 6

2002-11-01 Thread Garrett Goebel
David Wheeler wrote:
> On Friday, November 1, 2002, at 12:21  PM, Michael Lazzaro wrote:
> 
> >   ^[op] - [maybe] synonym for «op»
> > - [maybe] synonym for »op«
> 
> I think that would be:
> 
>`<> - synonym for «op»
>`>>op<< - synonym for »op«
> 
> Unless I misunderstood Larry's post, in which case it might be:
> 
>`<>` - synonym for «op»
>`>>op<<` - synonym for »op«

I think that was:

   `<> - synonym for «op»
   `>>op`<< - synonym for »op«

Larry wrote:
> I could see using backtick as the "escape" code for things
> like `<< or `>> which would turn into what some benighted
> soul called "girly" angles.

--
Garrett Goebel
IS Development Specialist

ScriptPro   Direct: 913.403.5261
5828 Reeds Road   Main: 913.384.1008
Mission, KS 66202  Fax: 913.384.2180
www.scriptpro.com  [EMAIL PROTECTED]



Re: [RFC] Perl Operator List, TAKE 6

2002-11-01 Thread Andrew Wilson
On Fri, Nov 01, 2002 at 12:21:43PM -0800, Michael Lazzaro wrote:
>   +&+|+^<<>>- bitwise (integer) operations
>   +&=   +|=   +^=   <<=   >>=

I might have missed this, but if + introduces bitwise operations,
why aren't we using it in the shift operations?  

+&+|+^+<+>- bitwise (integer) operations
+&=   +|=   +^=   +<=   +>=

Would seem to be more consistent and frees up << and >> for something
else.

andrew
-- 
Virgo: (Aug. 23 - Sept. 22)
It's been almost three decades, but you think you're finally beginning
to recover from the long, national nightmare of Vietnam movies.



Re: [RFC] Perl Operator List, TAKE 6

2002-11-01 Thread Uri Guttman
> "ML" == Michael Lazzaro <[EMAIL PROTECTED]> writes:

  ML>+&+|+^<<>>- bitwise (integer) operations
  ML>+&=   +|=   +^=   <<=   >>=

  ML>~&~|~^- charwise (string) operations
  ML>~&=   ~|=   ~^=

i think those descriptions need to be a little better.  i would say
'bitwise operations on (integer|string) value.

uri

-- 
Uri Guttman  --  [EMAIL PROTECTED]   http://www.stemsystems.com
- Stem and Perl Development, Systems Architecture, Design and Coding 
Search or Offer Perl Jobs    http://jobs.perl.org



Re: [RFC] Perl Operator List, TAKE 6

2002-11-02 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Sat, 2 Nov 2002 01:15:05 +0200
> From: <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
> 
> Michael Lazzaro writes:
> 
>  > magical whitespace modifier:
>  > 
>  >_ - When used at the end of a line or between
>  >statement elements, acts to "remove" whitespace
>  >when interpreting the statement.  (Allows
>  >whitespace to appear without invoking any
>  >special interpretations normally associated
>  >with that whitespace.)
>  > 
> 
> my understanding from the discussions was that 
> "free"  ( separated by spases ) _ is still placeholder . and it
> becomes "spaceeater" only when "attached" to operator . And a special
> rule for block ending curly "}_" .  

What _are_ you talking about.  IIRC, there were never any plans for
such a "placeholder."  There were the placeholder _variables_, $^x et
al., but the underscore was never used for such a thing.  That could
be why I've been so confused by some of your examples.

Luke



Re: [RFC] Perl Operator List, TAKE 6

2002-11-02 Thread fearcadi
Luke Palmer writes:
 > 
 > What _are_ you talking about.  IIRC, there were never any plans for
 > such a "placeholder."  There were the placeholder _variables_, $^x et
 > al., but the underscore was never used for such a thing.  That could
 > be why I've been so confused by some of your examples.
 > 

i am sorry , you are right , somehow i had an impressionthat _ + _ is
a valid syntax , butthis is different language

aracdi



Re: [RFC] Perl Operator List, TAKE 6

2002-11-05 Thread Dennis Haney
Michael Lazzaro wrote:


  ~ - force to string context



  ~ ~=  - string concat


ARG. When did this get chosen?
~ has to be absolutly the most difficult letter to type on the intire 
keyboard along with ^ and ", because they are also used as a prefix to 
make û, ü, õ, ã, ñ etc.
Thus a standalone ~ must be made with a AltGr+^ followed by a space.





Re: [RFC] Perl Operator List, TAKE 6

2002-11-06 Thread Larry Wall
On Tue, Nov 05, 2002 at 08:18:18PM +0100, Dennis Haney wrote:
: Michael Lazzaro wrote:
: 
: >  ~ - force to string context
: 
: >  ~ ~=  - string concat
: 
: ARG. When did this get chosen?
: ~ has to be absolutly the most difficult letter to type on the intire 
: keyboard along with ^ and ", because they are also used as a prefix to 
: make û, ü, õ, ã, ñ etc.
: Thus a standalone ~ must be made with a AltGr+^ followed by a space.

Bummer.  Oh well.  You're not supposed to use string concatenation
all that often anyway...

Larry



Re: [RFC] Perl Operator List, TAKE 6

2002-11-06 Thread John Adams
On Wed, 6 Nov 2002 11:13:36 -0800 Larry Wall <[EMAIL PROTECTED]> wrote:

> You're not supposed to use string concatenation
> all that often anyway...

I'm not supposed (for some value of supposed) to use Perl at my job, but I do,
and I suspect I use string concatenation in about one script in five, so
should I vote Scylla or Charybdis?

Thanks,

  John A
  see me fulminate at http://www.jzip.org/