[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ANN: Free-form-operators patch

Markus

10/8/2004 5:09:00 PM

All --

This time instead of a long description I will give to you a long
URL:

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

Free form operators for ruby patch. Define your own --> and =~~ as you
see fit. Impress your friends. Confound your enemies. And it really
really works.

I hope.

The web page is pre-alpha but the patch is beta.

PLEASE let me know if you try this, and especially if you find any
bugs. My intent is that it won't break _any_ existing code.

-- Markus




101 Answers

vruz

10/8/2004 5:36:00 PM

0

> PLEASE let me know if you try this, and especially if you find any
> bugs. My intent is that it won't break _any_ existing code.


Eeeeeeeeeeeeeeeeee-vil !!

Eeeeeeeeeeeeeeeeeeeeeee-vil !!
hehehe

have fun :-)


Markus

10/8/2004 5:45:00 PM

0

On Fri, 2004-10-08 at 10:35, vruz wrote:
> > PLEASE let me know if you try this, and especially if you find any
> > bugs. My intent is that it won't break _any_ existing code.
>
>
> Eeeeeeeeeeeeeeeeee-vil !!
>
> Eeeeeeeeeeeeeeeeeeeeeee-vil !!
> hehehe
>
> have fun :-)

But...but...my _heart_ is pure!

-- Markus

P.S. Well, purer that some of my code at least.




ptkwt

10/8/2004 6:24:00 PM

0



In article <1097255312.3754.1147.camel@lapdog.reality.com>,
Markus <markus@reality.com> wrote:
>All --
>
> This time instead of a long description I will give to you a long
>URL:
>
>http://www.reality.com/roberts/markus/software/ruby/free_form_...
>
>Free form operators for ruby patch. Define your own --> and =~~ as you
>see fit. Impress your friends. Confound your enemies. And it really
>really works.
>
>I hope.
>
>The web page is pre-alpha but the patch is beta.
>
>PLEASE let me know if you try this, and especially if you find any
>bugs. My intent is that it won't break _any_ existing code.
>

Cool... Nice toy...
I'm sure you learned a lot about Ruby's innards doing this.

Phil

gabriele renzi

10/8/2004 6:41:00 PM

0

Markus ha scritto:
> All --
>
> This time instead of a long description I will give to you a long
> URL:
>
> http://www.reality.com/roberts/markus/software/ruby/free_form_...
>
> Free form operators for ruby patch. Define your own --> and =~~ as you
> see fit. Impress your friends. Confound your enemies. And it really
> really works.

I like the idea of free form operators and actually I'd like even prefix
freeform ops, if this patch allow them :)

Hal E. Fulton

10/8/2004 6:55:00 PM

0

gabriele renzi wrote:
> Markus ha scritto:
>
>> All --
>>
>> This time instead of a long description I will give to you a long
>> URL:
>>
>> http://www.reality.com/roberts/markus/software/ruby/free_form_...
>>
>> Free form operators for ruby patch. Define your own --> and =~~ as you
>> see fit. Impress your friends. Confound your enemies. And it really
>> really works.
>
>
> I like the idea of free form operators and actually I'd like even prefix
> freeform ops, if this patch allow them :)
>

It is cool and interesting from a theoretical standpoint, but it causes me
to coin the term "syntax diabetes" (if someone hasn't already).


Hal




Markus

10/8/2004 6:58:00 PM

0

On Fri, 2004-10-08 at 11:44, gabriele renzi wrote:
> Markus ha scritto:
> > All --
> >
> > This time instead of a long description I will give to you a long
> > URL:
> >
> > http://www.reality.com/roberts/markus/software/ruby/free_form_...
> >
> > Free form operators for ruby patch. Define your own --> and =~~ as you
> > see fit. Impress your friends. Confound your enemies. And it really
> > really works.
>
> I like the idea of free form operators and actually I'd like even prefix
> freeform ops, if this patch allow them :)

Not yet. I can see how to do it, but haven't quite finished thinking
through the details. I'd also like to have some way to control the
precedence/associativity/arity, but I haven't figured out a way to do it
that I'm sure could be made consistent.

-- Markus



Jason Voegele

10/8/2004 7:17:00 PM

0

Markus said:
> On Fri, 2004-10-08 at 11:44, gabriele renzi wrote:
>> I like the idea of free form operators and actually I'd like even
>> prefix freeform ops, if this patch allow them :)
>
> Not yet. I can see how to do it, but haven't quite finished thinking
> through the details. I'd also like to have some way to control the
> precedence/associativity/arity, but I haven't figured out a way to do it
> that I'm sure could be made consistent.

FYI, Eiffel has user-defined prefix and infix operators. The language
rule is that all user-defined operators have a higher precedence than
built-in operators. The built-in operators follow typical precedence
rules.

--
Jason Voegele
"There is an essential core at the center of each man and woman that
remains unaltered no matter how life's externals may be transformed
or recombined. But it's smaller than we think."
-- Gene Wolfe, The Book of the Long Sun





Markus

10/8/2004 7:18:00 PM

0

On Fri, 2004-10-08 at 11:54, Hal Fulton wrote:
> gabriele renzi wrote:
> > Markus ha scritto:
> >
> >> All --
> >>
> >> This time instead of a long description I will give to you a long
> >> URL:
> >>
> >> http://www.reality.com/roberts/markus/software/ruby/free_form_...
> >>
> >> Free form operators for ruby patch. Define your own --> and =~~ as you
> >> see fit. Impress your friends. Confound your enemies. And it really
> >> really works.
> >
> >
> > I like the idea of free form operators and actually I'd like even prefix
> > freeform ops, if this patch allow them :)
> >
>
> It is cool and interesting from a theoretical standpoint, but it causes me
> to coin the term "syntax diabetes" (if someone hasn't already).

Ok, I'll bite. Why? Some details:

* If you don't use it, it should have no effect (not true with
today's version, which has two known bugs at this moment, but
that's the goal).
* It makes the parser about 150 lines shorter
* It does not effect compile times
* It might make it possible to move some features out of the core
language and into libraries (if it were proposed and accepted as
something more than an experimental hack).
* It (with some of the other ideas that have been floated) would
reduce the pressure to add new features, and allow them to be
"community tested" before being added, by letting people
prototype their ideas without being relegated to a syntactic
ghetto.

In what sense is this "diabetes"? I would take that to mean intolerance
for syntactic sugar (it sends you into a coma or something). Or am I
missing your point?

-- Markus




Markus

10/8/2004 7:22:00 PM

0

On Fri, 2004-10-08 at 12:17, Jason Voegele wrote:
> Markus said:
> > On Fri, 2004-10-08 at 11:44, gabriele renzi wrote:
> >> I like the idea of free form operators and actually I'd like even
> >> prefix freeform ops, if this patch allow them :)
> >
> > Not yet. I can see how to do it, but haven't quite finished thinking
> > through the details. I'd also like to have some way to control the
> > precedence/associativity/arity, but I haven't figured out a way to do it
> > that I'm sure could be made consistent.
>
> FYI, Eiffel has user-defined prefix and infix operators. The language
> rule is that all user-defined operators have a higher precedence than
> built-in operators. The built-in operators follow typical precedence
> rules.

Yes, that was part of my inspiration for this. In theory it is
simple; in practice (especially since I don't know C) the devil has been
in the details. Specifically, Eiffel doesn't execute
definitions/declarations, while ruby does. This makes life more
interesting.

-- Markus



Hal E. Fulton

10/8/2004 7:44:00 PM

0

Markus wrote:
>>
>>It is cool and interesting from a theoretical standpoint, but it causes me
>>to coin the term "syntax diabetes" (if someone hasn't already).
>
>
> Ok, I'll bite. Why? Some details:
>
> * If you don't use it, it should have no effect (not true with
> today's version, which has two known bugs at this moment, but
> that's the goal).
> * It makes the parser about 150 lines shorter
> * It does not effect compile times
> * It might make it possible to move some features out of the core
> language and into libraries (if it were proposed and accepted as
> something more than an experimental hack).
> * It (with some of the other ideas that have been floated) would
> reduce the pressure to add new features, and allow them to be
> "community tested" before being added, by letting people
> prototype their ideas without being relegated to a syntactic
> ghetto.
>
> In what sense is this "diabetes"? I would take that to mean intolerance
> for syntactic sugar (it sends you into a coma or something). Or am I
> missing your point?
>

I can't argue with certainty that it's a bad thing. I'm strongly in favor of
experimentation, in fact.

It might even be a great thing in Ruby 1.9 -- but I (personally) would not
want to see it permanently in Ruby.

This is just my opinion, so don't take it the wrong way. And don't stop your
experimentation. ;)

I believe that a language should provide "all the power you need" but "not
too much more than you need." This is admittedly highly subjective.

As a silly example: Suppose we made Ruby's syntax so extensible that we could
bend and twist it pretty much any way we wished. It would only be days before
some people started writing "Ruby that wasn't really Ruby." For example, someone
would do: require 'ruby2pascal' and then the rest of his program would be in
Pascal syntax. Someone else would do the same with Ada and whatever else is
out there.

At that point, yes, I would definitely go into a coma.

Don't we see this happening to some limited extent already? I would say that
some of the libraries and coding techniques I have seen in the past five years
constitute "using Ruby's flexibility to undermine Ruby" -- if you will pardon
the analogy, rather in the same way that terrorists have taken advantage of the
freedoms in the USA to destroy those same freedoms. (I hesitated to type that
last sentence, because there is no genuine comparison between casual misuse
of a programming language and the taking of innocent lives. But I am speaking
in a purely abstract sense: A sufficiently open system can be turned against
itself to undermine that openness. Flames and political discussion will be
redirected to /dev/null).

I don't speak for Matz or claim any insight into his thought processes. However,
that is exactly what I *strive* to do -- I strive to think like Matz. And in the
light of things I have heard him say about macros, about continuations, and so on,

I'm ignorant of Lisp. (Do people get tired of hearing me say that?) But I note
that Matz is at least extremely cautious (I would say outright opposed) to having
macros in Ruby. And yet he admits that callcc is also very powerful, yet he permits
it to exist in Ruby. I perceive it as a balance.

Of course, even Matz is not the ultimate genius of this planet. But he has created
something very special in Ruby, in my opinion; something that could not have been
created by a committee. There are many other people I want to learn from; but at
the moment, he is at the top of my list.

I would be pleased if Matz agreed with what I say here. But I would also be pleased
if he disagreed, because that is another opportunity for me to learn.


Cheers,
Hal