ANN: Free-form-operators patch

Spaces b/c important, which isn't necessarily a bad thing. A rule that
operator "on top of operator" requires a space solves problem. So

  '!1' or '! 1'

is fine, but two in a row must be

  '! !1' or '! ! 1', not '!!1'

as '!!' would be considered one operator.

Or did you figure out a better way, Markus?

T.

···

On Friday 08 October 2004 11:59 pm, Jim Weirich wrote:

Now back to the legal operators ...

(A) is legal, e.g. 2<-+1 => false
(B) is illegal, e.g. 2+/-1 => illegal, however, 2/-1 is legal
(C) is illegal (but I'm not sure why)
! ~~1 is legal, but !~~1 gives strange results
try: ruby -e '!~~1' and see for yourself.
(D) is legal, e.g. ++1 => 1

Anyways, I'm not sure it will be immediately obvious to the casual
observer that +/- is a user defined operator and ++ and <+- are
concatenations of existing legal Ruby built in operators. (Or that !~~
looks like a concatentation of built in operators, but for some reason
is not).

Markus wrote:
> This is a very good description of why I'm unsure about letting the
> user set the precedence/associativity/arity. Do you mind if I use it?

Please do!

     Thanks.

> I'm being a bit more conservative at this point: only characters
> that are already found in ruby operators (and only on combinations that
> are not already used) may be user defined.

Hmmm ... I felt my position was the conservative one :slight_smile: I think yours
will be quite hard on the programmer.

Quick, without looking ahead ... which of the following operators can
appear in valid ruby code today ...

     (A) <-+
     (B) +/-
     (C) !~~
     (D) ++

I'll comment on something else (to provide spoiler prevention :slight_smile:

     I'll reply without reading ahead. I don't think any of them are
valid operators in a version of ruby without my patch or something like
it. (D) could occur in the construct x++3, but it would be two
operators. With my patch, any of them could be used as operators if you
defined them, but (D) would generate a warning and parse as two
operators if you didn't make your intention clear with white space.
((A) and (B) would also warn.) I'll read on and see how I did...

>>[...] User defined Binary operators should
>>be the same as the highest precedence binary operator under the unary
>>operators.
>
> Why the highest? I know that's how eiffel does it, but I don't
> recall the rational. I've also considered some function of the length
> or contents (such that the built in operators would "fit" the scheme),
> but I haven't found anything I like.

I'm not strongly tied to it being the highest. Whatever it is, it
should be easy to remember. I don't want to have to remember 35 levels
of operator precedence (I can go back to C++ if I want that).

So highest seems like an easy to remember option. If you have another
easy to remember scheme, I would be open to it.

     *sigh* Alas, I do not.

Now back to the legal operators ...

(A) is legal, e.g. 2<-+1 => false
(B) is illegal, e.g. 2+/-1 => illegal, however, 2/-1 is legal
(C) is illegal (but I'm not sure why)
      ! ~~1 is legal, but !~~1 gives strange results
      try: ruby -e '!~~1' and see for yourself.
(D) is legal, e.g. ++1 => 1

     Ooooo! Good catch on (A). It's three operators though. The main
cost of this patch is that operators will have to be treated the same
way identifiers are; you can't run them together indiscriminately and
have the compiler guess what you meant.

Anyways, I'm not sure it will be immediately obvious to the casual
observer that +/- is a user defined operator and ++ and <+- are
concatenations of existing legal Ruby built in operators. (Or that !~~
looks like a concatentation of built in operators, but for some reason
is not).

     That's why you use white space. Note that the confusions you
listed were not created by the free form operators, but were present in
the language all along.

-- Markus

···

On Fri, 2004-10-08 at 20:59, Jim Weirich wrote:

!~ is a binary operator; "a !~ b" expands to "not (a ~= b)", in the same way
that "a != b" expands to "not (a == b)"

I can't see any useful way to use the construct
     a !~ (~b)
with the standard classes though. e.g. ~/bar/ matches /bar/ against $_, but
returns an integer or nil.

Regards,

Brian.

···

On Sat, Oct 09, 2004 at 12:59:40PM +0900, Jim Weirich wrote:

(C) is illegal (but I'm not sure why)
     ! ~~1 is legal, but !~~1 gives strange results
     try: ruby -e '!~~1' and see for yourself.

David A. Black wrote:

If you don't believe there is such a thing as "too much flexibility," then we
will have to agree to disagree.

Just so Hal doesn't feel all alone, I'll put in a note of skepticism
:slight_smile: I'm not eager for Ruby to have, in essence, no fixed syntax. I
think Ruby's strength lies largely in its specificity as a language --
a language that is good at domain-specific things, but still a
particular language -- and if it were turned into a kind of
proto-language, I would feel a sense of loss. Also, I don't want to
have to learn new syntactic rules every time I want to read a program
or use a library.

I agree with Hal and David. Part of what appeals to me about Ruby (or any other language) is identity or integrity--in essence, having a Ruby Way.

I don't complain about it, but I find the substantial volume of traffic on ruby-talk comparing Ruby to this or that language, or discussing how to make Ruby more like this or that, tiresome. I read ruby-talk to become more expressive and powerful in (this) Ruby, and I really don't care how it stacks up in a Consumer Reports-style feature comparison.

I'm especially wary of extensions to syntax. I don't mind looking up semantics, but I want to handle syntax without help.

Steve

···

On Sat, 9 Oct 2004, Hal Fulton wrote:

Just so Hal doesn't feel all alone, I'll put in a note of skepticism
:slight_smile: I'm not eager for Ruby to have, in essence, no fixed syntax. I
think Ruby's strength lies largely in its specificity as a language --
a language that is good at domain-specific things, but still a
particular language -- and if it were turned into a kind of
proto-language, I would feel a sense of loss. Also, I don't want to
have to learn new syntactic rules every time I want to read a program
or use a library.

     I think you are grossly misunderstanding what the patch does. It
does not make ruby's syntax more complicated or more variable; in fact,
part of the goal (see the thread about a month back on Hash,
Association, & the => construct) is to make the syntax simpler and more
consistent.

     At present, if you see a concatenation of operator-characters you
have to wonder: is that an operator? Is that a build in part of the
syntax? Is it an error? Or maybe it's two or more operators run
together...I wonder where the breaks should be.

     If this change were made standard (and it is no where near ready
for that at this moment) you would simply say "ah, that's an operator"
in the same way that you can now say "ah, that's a method call" or "ah,
that's an integer."

I know the argument gets made a lot that it can't hurt to have this
feature, that feature, etc., because no one has to use them. I think
that misses the point, though. It's like saying: a flute should have
strings like a violin, in case someone wants it to be a violin. What
you end up with, eventually, is not a musical instrument but a kind of
buffet of characteristics, adding up to nothing. I consider Ruby not
only an instrument, but a work of art, like a flute or violin.

     Ultimately, this patch would involve simplifying the parser,
removing parts rather than adding them.

The idea of something being treated as either a flute or a violin
sounds like duck typing :slight_smile: What I'm saying, in those terms, is that
I don't consider Ruby itself to be a Ruby object. It's
interesting.... I've thought for a long time that the flexibility and
dynamism of Ruby objects sometimes rubs off on people's views of the
language itself, so that the perception, expectation, or desire is for
Ruby itself to be untyped, open, malleable, and so forth. (Or is that
'mallardeable'? :slight_smile: I tend to think of Ruby, instead, as a quite
stable and distinctive thing whose stability supports the dynamism of
the objects.

     "mallardeable: able to be duck typed"! I like that!

But at that level it's fine to agree to disagree; there is of course
nothing whatsoever wrong with experimentation. I guess my more
concrete fear -- and I tend to feel this way about all interpreter
patches -- is that people will start releasing programs that depend on
the patch. At that point, it would be better to do an outright fork
of Ruby. But hopefully that won't be an issue. Mainly I just tend to
agree with Hal that this particular change affects the whole profile
and identity of the language.

     1) I have no intention of forking, 2) I have no intention of
releasing programs that depend on this (though I may show samples of how
it could be used). 3) You guys are way overestimating the significance
and impact of this patch. All I'm ultimately doing is cleaning up some
special cases in the syntax, making it so that things work consistently.

     I'd rather see potential language ideas floated as patches so that
people can try them and see if they like them before they get stuck with
them, but that's just the form my change adversity takes.

-- Markus

···

On Sat, 2004-10-09 at 07:20, David A. Black wrote:

Count me on the side of the sceptics. I have the precise worry that
David express here.

There is one limitation on the concept that I think might mitigate my
fears (I've not quite decided yet): Restrict it to work for very
specific domain languages.

In other words, make it so you have to do an
operator_eval(my_operator_set) {
   ... code with weird operators here ...
}
to make it work.

However, I'm not certain how the utility of extra operators with that
restriction would turn out.

Eivind.

···

On Sat, 9 Oct 2004 23:20:41 +0900, David A. Black <dblack@wobblini.net> wrote:

On Sat, 9 Oct 2004, Hal Fulton wrote:
> I stand by the abstraction: A sufficiently open system can be turned against
> itself to undermine that openness.
>
> There are millions of ways to concretize that abstraction, but most of those
> are otherwise unrelated to each other, and they range from the momentous to
> the inconsequential. I have no reason and no desire to compare you to a terrorist
> or any other form of criminal.
>
> If you don't believe there is such a thing as "too much flexibility," then we
> will have to agree to disagree.

Just so Hal doesn't feel all alone, I'll put in a note of skepticism
:slight_smile: I'm not eager for Ruby to have, in essence, no fixed syntax. I
think Ruby's strength lies largely in its specificity as a language --
a language that is good at domain-specific things, but still a
particular language -- and if it were turned into a kind of
proto-language, I would feel a sense of loss. Also, I don't want to
have to learn new syntactic rules every time I want to read a program
or use a library.

Nikolai Weibull ha scritto:

That's basically saying that since the method implies? isn't a standard
method, what could happen if Angelina and Joe Automator implement it for
different things.

sure, but a method has a name wich explains what it does, an operator does not. I understand that this thinking brings to "let's remove all operators!" mood, but actually having just some is ok, specially if they have a widely used meaning (say, + )

Maybe we could be happy if standard operators such as
+= or != could be overriden, and everything could become prefix.

+= is given by +, so that's no problem.
  nikolai

actually, I'd like to override += (just think of Array#+= done via in place addition or with sum and reassign), just to say :slight_smile:

Similarly, if user defineable operators become a part of the language,
nobody will be required to use them.

I'll just chime in once, to say I support Hal's view, which he expressed
very eloquently.

I realise that I am treading on somewhat dangerous water here, in that I
have been involved in other threads on things like method call versus block
call semantics. I'm not saying the language cannot be improved, and I'm
equally sure a lot of user input and suggestions over the last ten or eleven
years have helped make 1.8.x as good as it is.

However, ISTM that what's being described here is a substantially different
language to Ruby. Sure, there is some intellectual satisfaction in the
exercise; you can continue down this route making the language somehow more
'flexible' or 'pure' or 'minimalist' or whatever - like removing instance
variables altogether and replacing them with closures. It would be
interesting to see what the smallest subset of Ruby is that can bootstrap up
to the full feature set. Maybe it would end up looking like Lisp (or Eiffel,
Smalltalk, Haskell or many other languages mentioned here as comparatives
before which I don't know or use)

However, Matz has been doing the language-design exercise for more than 10
years, and most of us are very happy with what he's produced. This idea has
probably been floated and considered in the past. If it's not in the
language, probably it doesn't fit his overall world view of what the
language should look like. Draw your own conclusions from his silence on
this thread, and on the likelihood of this feature ever making it into the
core.

If it doesn't do anything important, it will be
forgotten.

If it doesn't do anything important, then it shouldn't have been added in
the first place. ISTM that user-defined operators are nothing more than
syntactic sugar, which Ruby has plenty of already, and add nothing that
can't be done with a handful more keystrokes. I'd rather see discussion on
language semantics, which can make life substantially easier or harder when
programming.

If it does, then those who find it important will learn how
to use that feature. And if someone wants to use two mutually
incompatible dialects, then they will need to come up with a way to
harmonize them.

Or just use a different language in the first place, which is more suitable
to their particular problem domain.

Ruby matches the problem domains that I deal with very nicely at the moment.

It shouldn't, and doesn't have to be, an all or nothing kind of thing.
It should be a"Use however much you want, and don't complain bitterly if
you cut your finger on the bleeding edge. You were warned." kind of
thing. Naturally exotic features will have less support.

The original comment I wrote at this point was:

"Personally I see Ruby as a stable platform to do real work on, not an
experimental platform for wannabe language designers."

But then I realised it sounded bitchy as hell. No offence is intended to
anyone, so please substitute a less inflammatory statement of your choosing.

Regards,

Brian.

···

On Sun, Oct 10, 2004 at 04:19:30AM +0900, Charles Hixson wrote:

> Ruby (high to low) User defined examples with same precedence
> ** R** **R R**R (contains ** goes right to top)
> ! ~ + - all unary operators (can we do those 'def
> @++' ?) * / % *R /R %R
> + - +R -R
> & &R
> ^ | ^R |R
> < > <R R>
> = =R R=R (equals on end illegal)
>
> It may have to be a bit more complex then that but you get the idea. Like
> I said, just a thought.

     That was my "doodle in meeting" project for a few days last week.
I didn't come up with anything I liked. For example, what do you do
with something that comprises two or more extant operators? How do you
decide which part is the R and which is not-R? How do you find the
buddha-nature of a missmatched pair of socks? And what if there is a
chance congruence hidden in an operator that the users don't see?

Hmm.. well, workable rules can be made.The rules themsleves have precedence
top tp bottom:

  1. contains ** precedence level 0 (highest)
  2. unaries level 1
  3. starts with < or ends with >, level 6
  4. contains =, level 7 (lowest)
  5. starts with * / %, level 2
  6. starts with + -, level 3
  7. starts with &, level 4
  8. starts with ^ |, level 5

OTOH, if you are saying such rules don't always pleases you, well you have two
choices: make precedence user definable with all the baggage that looks like
it will entail, or accept that you can't always be pleased and that following
Ruby's general order at least makes it easy to remember.

     I'll add you suggestions to my notes, but I'm not optimistic about
that path.

Well, you never really know until you try. Right?

T.

···

On Friday 08 October 2004 11:46 pm, Markus wrote:

trans. (T. Onoma) wrote:

Spaces b/c important, which isn't necessarily a bad thing. A rule that operator "on top of operator" requires a space solves problem. So

  '!1' or '! 1'

is fine, but two in a row must be

  '! !1' or '! ! 1', not '!!1'

This is fine, but at this point you are making incompatible changes to Ruby. I don't want user defined operators nearly so much that I would want to break existing code.

···

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Well, such things are important. Good ideas rarely (if ever) just pop out of
thin air. Netwon himself stood on shoulders. So its important that people
talk about such things. It helps people learn why Ruby is the way it is and
it helps Ruby improve, and some of us just plain enjoy it! :wink:

Yet, I know some people, like yourself, feel this way about ruby-talk. So I
have tried multiple times to get a separate mailing list invigorated for this
very purpose. But none of the major players will back it, and as long as that
is the case it just won't fly, and these discussions _will_ continue here. I
can only assume that the Ruby community is just to small to support the
division of lists.

So Ruby-talk remains the avenue for these explorations, which indeed tend to
be long and detailed by their very nature.

Sorry,
T.

···

On Saturday 09 October 2004 12:10 pm, Steven Jenkins wrote:

I agree with Hal and David. Part of what appeals to me about Ruby (or
any other language) is identity or integrity--in essence, having a Ruby
Way.

I don't complain about it, but I find the substantial volume of traffic
on ruby-talk comparing Ruby to this or that language, or discussing how
to make Ruby more like this or that, tiresome. I read ruby-talk to
become more expressive and powerful in (this) Ruby, and I really don't
care how it stacks up in a Consumer Reports-style feature comparison.

I'm especially wary of extensions to syntax. I don't mind looking up
semantics, but I want to handle syntax without help.

* gabriele renzi <rff_rff@remove-yahoo.it> [Oct 10, 2004 03:00]:

>+= is given by +, so that's no problem.

actually, I'd like to override += (just think of Array#+= done via in
place addition or with sum and reassign), just to say :slight_smile:

Well, there you go. Your whole reasoning just went down the drain. If
this would be allowed, how would anyone keep track of how += for
arrays differs from += for, say, integers. It's more confusing to alter
the meaning of some "well understood" operator than to add new ones with
new semantics,
  nikolai

···

--
::: name: Nikolai Weibull :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA :: loc atm: Gothenburg, Sweden :::
::: page: www.pcppopper.org :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

> Similarly, if user defineable operators become a part of the language,
> nobody will be required to use them.

I'll just chime in once, to say I support Hal's view, which he expressed
very eloquently.

I realise that I am treading on somewhat dangerous water here, in that I
have been involved in other threads on things like method call versus block
call semantics. I'm not saying the language cannot be improved, and I'm
equally sure a lot of user input and suggestions over the last ten or
eleven years have helped make 1.8.x as good as it is.

However, ISTM that what's being described here is a substantially different
language to Ruby. Sure, there is some intellectual satisfaction in the
exercise; you can continue down this route making the language somehow more
'flexible' or 'pure' or 'minimalist' or whatever - like removing instance
variables altogether and replacing them with closures. It would be
interesting to see what the smallest subset of Ruby is that can bootstrap
up to the full feature set. Maybe it would end up looking like Lisp (or
Eiffel, Smalltalk, Haskell or many other languages mentioned here as
comparatives before which I don't know or use)

However, Matz has been doing the language-design exercise for more than 10
years, and most of us are very happy with what he's produced. This idea has
probably been floated and considered in the past. If it's not in the
language, probably it doesn't fit his overall world view of what the
language should look like. Draw your own conclusions from his silence on
this thread, and on the likelihood of this feature ever making it into the
core.

> If it doesn't do anything important, it will be
> forgotten.

If it doesn't do anything important, then it shouldn't have been added in
the first place. ISTM that user-defined operators are nothing more than
syntactic sugar, which Ruby has plenty of already, and add nothing that
can't be done with a handful more keystrokes. I'd rather see discussion on
language semantics, which can make life substantially easier or harder when
programming.

> If it does, then those who find it important will learn how
> to use that feature. And if someone wants to use two mutually
> incompatible dialects, then they will need to come up with a way to
> harmonize them.

Or just use a different language in the first place, which is more suitable
to their particular problem domain.

Ruby matches the problem domains that I deal with very nicely at the
moment.

> It shouldn't, and doesn't have to be, an all or nothing kind of thing.
> It should be a"Use however much you want, and don't complain bitterly if
> you cut your finger on the bleeding edge. You were warned." kind of
> thing. Naturally exotic features will have less support.

The original comment I wrote at this point was:

"Personally I see Ruby as a stable platform to do real work on, not an
experimental platform for wannabe language designers."

But then I realised it sounded bitchy as hell. No offence is intended to
anyone, so please substitute a less inflammatory statement of your
choosing.

Regards,

Brian.

Know what noise is? Another word for static. Know what static is? Something
that never changes. You know what something that never changes is?

  D E A D

Honestly I sick and tired reading emails about how it is bad bad bad to talk
about changes to Ruby.

Anyone remember this?

> Now, rb_iv_set/rb_iv_get aren't visible from the Ruby side
> (apparently), but they are visible from the C side. Are there good
> reasons to not allow this, or can we modify it so that iv_get and
> iv_set (or better names for them) are available as private methods to
> go along with instance_variables?

Kernel#instance_variable_get and #instance_variable_set are
added in 1.8.

--
Nobu Nakada

It's not like matz and the other developers aren't interested and listenting.
If they weren't why would they _ever_ talk to the community about this stuff?
matz is quiet b/c his postion requires that he be very conservative. That
doesn't mean the rest of us shouldn't pursue our dreams. Every once in a
while one of those "gets out of the park", and ends up making Ruby better.

Brian, I'm a bit surprised at this given our conversation on Range class. Hal,
I'm not surprised at all. Seems like you bring this up every time a Ruby
suggestion thread (with which you don't agree with, of course) gets any
significant feedback.

Even so, I'm a nice guy. I feel for you. But you can't say I haven't tried
--I've pushed for a separate mailing list for this stuff for, lord knows, how
long now?

T.

···

On Sunday 10 October 2004 05:48 am, Brian Candler wrote:

On Sun, Oct 10, 2004 at 04:19:30AM +0900, Charles Hixson wrote:
At Tue, 1 Apr 2003 13:08:42 +0900, > Austin Ziegler wrote:

> Similarly, if user defineable operators become a part of the language,
> nobody will be required to use them.

However, ISTM that what's being described here is a substantially different
language to Ruby.

     Again, I think you are grossly overestimating what this patch does.

      * Ruby already has a number of user definable operators, all
        pulled from a set of operators characters.
      * Ruby already gives users the ability to define any identifier
        they want, by combining identifier characters in any order they
        want, provided they don't conflict with a fixed set of keywords.

     At it's core, all this patch does is remove the asymmetry in how
operator tokens are defined (to include any combination of operator
characters, using a simplified for of the code for identifiers).

      * 90% of the change is in the lexer (which defines the composition
        of symbols).
      * The only reason the parser (which defines the syntax of ruby) is
        touched at all is to simplify prevention of conflicts with
        existing code & simplify the generation of meaningful error
        messages. All of the changes in the parser consist of
        duplicating a rule under a different name, which DOES NOT CHANGE
        THE SYNTAX at all.

     Not only is the language not "substantially different" it isn't
technically different at all.

However, Matz has been doing the language-design exercise for more than 10
years, and most of us are very happy with what he's produced. This idea has
probably been floated and considered in the past. If it's not in the
language, probably it doesn't fit his overall world view of what the
language should look like. Draw your own conclusions from his silence on
this thread, and on the likelihood of this feature ever making it into the
core.

     Oh, that's just silly.

     First of all, as I have made clear every time it came up, I am not
proposing (and will not propose) this for inclusion in the language
until/unless it can be shown to work in a way that does not break any
existing code, etc. We're not there yet.

     Second, I have always found matz very open and able to perfectly
express himself. I don't need to "draw conclusions from his silence"
since I'll have ample opportunity to draw conclusions from whatever he
says if and when he says anything.
     If I were to guess, I'd guess that he's waiting to see if I can
even make it work; he certainly knows how tricky even small changes can
be to get just right, and has seen several example of my C-skills (or
relative lack there of) over the last five years. If I can't make it
work, why bother arguing it (present company excepted of course)?

     Third, I would never want the users of any of my software to assume
that missing features are missing because they don't fit my overall
world view. Nor would I want them to assume that bugs were there
intentionally, or read my silence as criticism. I'm pretty sure from
past interactions with him matz fells the same way.

     Matz is a nice, reasonable, and very intelligent guy. If (and the
jury is still out) I can make this work and suggested it for actuall
use, but do so in a way that is incompatible with the big picture, I'm
sure he'll point it out to me himself.

> If it doesn't do anything important, it will be
> forgotten.

If it doesn't do anything important, then it shouldn't have been added in
the first place. ISTM that user-defined operators are nothing more than
syntactic sugar, which Ruby has plenty of already, and add nothing that
can't be done with a handful more keystrokes. I'd rather see discussion on
language semantics, which can make life substantially easier or harder when
programming.

     There is a very specific need for the patch, as discussed earlier
on this list.

     People (~five cases in the last two months) are arguing for changes
in the semantics of core classes because (and often only because) they
can't duplicate the functionality and/or subclass/modify it to suit
their needs.
     One of the main strengths of ruby is that if I want a class that is
kind of like Array, but has slightly different semantics, I can subclass
it, or build my own class and delegate, or just reimplement it from
scratch. I can to do this with almost any class.
     But there are a few classes (Hash & Range are the most current
examples) where "special syntax" is used, so I can't reimplement them to
suit. More to the point, no one can. This leads to long discussion
about how some core class "ought to work" when in fact 99% of the people
would be perfectly happy if they could roll their own versions as they
can with all the other classes.

     Ultimately, my goal is to provide a way to _increase_ the stability
of the core language (compiler + base classes) by reducing the pressure
for changes.

> If it does, then those who find it important will learn how
> to use that feature. And if someone wants to use two mutually
> incompatible dialects, then they will need to come up with a way to
> harmonize them.

Or just use a different language in the first place, which is more suitable
to their particular problem domain.

     Exactly the same problem arises with identifiers. Why aren't you
calling for a limit on user defined method names?

"Personally I see Ruby as a stable platform to do real work on, not an
experimental platform for wannabe language designers."

But then I realised it sounded bitchy as hell. No offence is intended to
anyone, so please substitute a less inflammatory statement of your choosing.

     No offence taken. In the (yikes!) twenty six years since I was
first paid to design and implement a language I've been called things a
lot worse. "Wannabe language designer" sounds a lot fresher and more
optimistic (i.e. younger) that "crotchity semi-retired language
designer," so it's sort of a complement.

     Now if people would only take me for a kid in person as readily as
they do on-line. *sigh*

     -- Markus

···

On Sun, 2004-10-10 at 02:48, Brian Candler wrote:

On Sun, Oct 10, 2004 at 04:19:30AM +0900, Charles Hixson wrote:

Hi,

···

In message "Re: ANN: Free-form-operators patch" on Sun, 10 Oct 2004 01:10:14 +0900, Steven Jenkins <steven.jenkins@ieee.org> writes:

I don't complain about it, but I find the substantial volume of traffic
on ruby-talk comparing Ruby to this or that language, or discussing how
to make Ruby more like this or that, tiresome. I read ruby-talk to
become more expressive and powerful in (this) Ruby, and I really don't
care how it stacks up in a Consumer Reports-style feature comparison.

I KNOW thinking about enhancing the language is FUN. But let me
propose moving RCR related things to ruby-core for plain users' sake.

              matz.

Actually, when you're trying to implement domain-specific languages atop
ruby, the operators often have a well-defined meaning; it just comes
from the domain rather than the larger body of 'programming languages'.
For instance, it might be nice to define a financial maths class with
$12 creating a money amount literal (what, no prefix operators? :)). It
also gives the community a chance to experiment with symbols for common
idioms (for instance, a ||+ b for elementwise array addition) - if the
symbols aren't intuitive they'll just die a natural death.

martin

···

gabriele renzi <rff_rff@remove-yahoo.it> wrote:

sure, but a method has a name wich explains what it does, an operator
does not. I understand that this thinking brings to "let's remove all
operators!" mood, but actually having just some is ok, specially if they
have a widely used meaning (say, + )

Sure. I understand. But I wonder how often two operators are used back to
back? I imagine that the most common case is !-1. And actually I think - +
should probably be considered literal "numeral" chars when in front of other
such chars always. Just the same, given the infrequency, I don't think it's
out of the question, unless I've over looked some common idioms. Think of
any?

T.

···

On Saturday 09 October 2004 12:27 am, Jim Weirich wrote:

trans. (T. Onoma) wrote:
> Spaces b/c important, which isn't necessarily a bad thing. A rule that
> operator "on top of operator" requires a space solves problem. So
>
> '!1' or '! 1'
>
> is fine, but two in a row must be
>
> '! !1' or '! ! 1', not '!!1'

This is fine, but at this point you are making incompatible changes to
Ruby. I don't want user defined operators nearly so much that I would
want to break existing code.

T (I never know what to call you. Trans? Someone said "Tom" once,
but I don't know if that was a guess)--anyway "T" pretty much nailed the
syntactic issue, but didn't get into how I am attempting to resolve it.
Short answer: if a concatenation of operator symbols might be ambiguous
I generate a warning (suggesting that spaces be used) and interpret it
as two separate operators (e.g., mimic the old behaviour). If you want
free form operators, and want to have them overlap with the existing
operators, you have to use spaces to make your meaning clear.

    -- Markus

···

On Fri, 2004-10-08 at 21:27, Jim Weirich wrote:

trans. (T. Onoma) wrote:
> Spaces b/c important, which isn't necessarily a bad thing. A rule that
> operator "on top of operator" requires a space solves problem. So
>
> '!1' or '! 1'
>
> is fine, but two in a row must be
>
> '! !1' or '! ! 1', not '!!1'

This is fine, but at this point you are making incompatible changes to
Ruby. I don't want user defined operators nearly so much that I would
want to break existing code.

trans. (T. Onoma) wrote:

Yet, I know some people, like yourself, feel this way about ruby-talk. So I have tried multiple times to get a separate mailing list invigorated for this very purpose. But none of the major players will back it, and as long as that is the case it just won't fly, and these discussions _will_ continue here. I can only assume that the Ruby community is just to small to support the division of lists.

For the record, I'm not saying such discussions are out of place, nor suggesting they be taken elsewhere. I've been reading Usenet and its descendants since 1984, and I know it's a lot easier to ignore stuff you don't like (or don't approve of) than to add a layer of meta-argument about whether you ought to be having the argument.

I'm just trying to encourage more discussion of hacking *in* Ruby, as opposed to hacking *on* Ruby.

Steve

I've just posted ver 0.3 of the acclaimed and controversial free-form
operator patch. It fixes all the bugs reported so far (including
supporting the "proc {|x,*|x}" monstrosity).

The web page is as bland/ugly as ever, and still at:

http://www.reality.com/roberts/markus/software/ruby/free_form_operators/

Thank's everyone for all the support, including those of you that have
supported by challenging my assumptions and/or sanity (or should I saw
"assumptions &&/|| sanity" in undertaking this in the first place.

-- Markus