by the way, what is your goal with your version of ruby? i’ve been
considering doing some language experimentation myself using the Ruby
source.
The goal is to reduce back down to the pure language. Practically, I need
something that I can embed although there’s no reason why it wouldn’t make a
strong stand alone version.
Once I’ve got a fast, well-written pure implementation, I’ll be in a better
position to see where it can go next.
by the way, what is your goal with your version of ruby? i’ve been
considering doing some language experimentation myself using the Ruby
source.
The goal is to reduce back down to the pure language. Practically, I need
something that I can embed although there’s no reason why it wouldn’t make a
strong stand alone version.
Once I’ve got a fast, well-written pure implementation, I’ll be in a better
position to see where it can go next.
by the way, what is your goal with your version of ruby? i’ve been
considering doing some language experimentation myself using the Ruby
source.
The goal is to reduce back down to the pure language. Practically, I need
something that I can embed although there’s no reason why it wouldn’t make a
strong stand alone version.
Once I’ve got a fast, well-written pure implementation, I’ll be in a better
position to see where it can go next.
by the way, what is your goal with your version of ruby? i’ve been
considering doing some language experimentation myself using the Ruby
source.
The goal is to reduce back down to the pure language. Practically, I need
something that I can embed although there’s no reason why it wouldn’t make a
strong stand alone version.
Once I’ve got a fast, well-written pure implementation, I’ll be in a better
position to see where it can go next.
I like the idea of named method parameters (ala Smalltalk, Objective-C).
There was a discussion elsewhere showing something similar using hash
tables. With a bit of syntactic sugar… :var => 10 could be var: 10
I want something more, for example:
class PC
def initialize(cpu:, os: “Windows”, **info) @cpu = cpu # “cpu” is a mandatory named arg @os = os # “os” is with the default value @info = info # symbol=>value hashtable
end
end
PC.new(os: “Linux”, cpu: “P-III”, clock: “600MHz”, hdd: “30G”)
I like Python’s way of not distinguishing between named and “unnamed”
parameters. The above would be:
I like the flexibility of not having to decide which parameters
should be named/unnamed.
Obviously, this would require some major changes to ruby. Also,
there might be performance penalties. For example, you would have
to store the names of all parameters with the method (though
that would be nice for introspection).
by the way, what is your goal with your version of ruby? i’ve been
considering doing some language experimentation myself using the Ruby
source.
The goal is to reduce back down to the pure language. Practically, I need
something that I can embed although there’s no reason why it wouldn’t make a
strong stand alone version.
Once I’ve got a fast, well-written pure implementation, I’ll be in a better
position to see where it can go next.
Well, the main thing here is that the ‘?’ and ‘:’ are part of the
accompanying symbols so they would be classed as part of the symbol name.
Ruby already does this for symbols ending in ‘?’. I don’t see what the
problem is. If we were talking about a C/C++ parser then that’s a different
matter…
Also, ‘yes:’ would only be valid inside a method argument list and so would
cause a parsing error in this case.
Well, the main thing here is that the ‘?’ and ‘:’ are part of the
accompanying symbols so they would be classed as part of the symbol name.
Ruby already does this for symbols ending in ‘?’. I don’t see what the
problem is. If we were talking about a C/C++ parser then that’s a different
matter…
Also, ‘yes:’ would only be valid inside a method argument list and so would
cause a parsing error in this case.
Well, the main thing here is that the ‘?’ and ‘:’ are part of the
accompanying symbols so they would be classed as part of the symbol name.
Ruby already does this for symbols ending in ‘?’. I don’t see what the
problem is. If we were talking about a C/C++ parser then that’s a different
matter…
Also, ‘yes:’ would only be valid inside a method argument list and so would
cause a parsing error in this case.
Well, the main thing here is that the ‘?’ and ‘:’ are part of the
accompanying symbols so they would be classed as part of the symbol name.
Ruby already does this for symbols ending in ‘?’. I don’t see what the
problem is. If we were talking about a C/C++ parser then that’s a different
matter…
Also, ‘yes:’ would only be valid inside a method argument list and so would
cause a parsing error in this case.
What about leaving the current API as is, and adding new methods to the
API that support named parameters (perhaps one method to “name” the
parameters and another to call methods using named parameters)?
Paul
···
On Wed, Jul 31, 2002 at 12:13:10AM +0900, ts wrote:
I always liked that idea, and was never too sure why it never got
discussed further.
In the case of C++, there is a C++ standard and a committee who composed
that standard.
There’s also no compiler in existence that is 100% compliant with that
standard. As a result, most of us either rely on the language features
that the greatest number of compilers support or just write for a
specific compiler.
Sometimes, there are extra features a compiler supports that come in
handy (g++, for example, supports the typeof operator). Some of these
features, if they are useful enough, often have a pretty good chance of
making their way into the standard.
Paul
···
On Wed, Jul 31, 2002 at 01:44:50AM +0900, Michael Campbell wrote:
I’m not sure this is relevant, but the gnu c++ compiler allows a
number of things that “normal” c++ does not; how do they handle that?
The goal is to reduce back down to the pure language. Practically, I need
something that I can embed although there’s no reason why it wouldn’t make
a
strong stand alone version.
Once I’ve got a fast, well-written pure implementation, I’ll be in a
better
position to see where it can go next.
Interesting, but what are your criteria for
a “pure” language implementation? How does
multithreading capability make it non-pure?
Does regular expression capability make it
non-pure?
By the way: Your messages seem to be showing
up two or three times on the list. A bug in
your posting software perhaps?
Cheers,
Hal
···
----- Original Message -----
From: “Justin Johnson” justinj@mobiusent.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Tuesday, July 30, 2002 1:16 PM
Subject: Re: Ruby Language Q’s
Obviously, this would require some major changes to ruby. Also,
there might be performance penalties. For example, you would have
to store the names of all parameters with the method (though
that would be nice for introspection).
ruby know the name of the parameters otherwise it will not possible to
write this
pigeon% ruby -riis -e 'def x(a, b = 12, &d) end; puts dump Object, :x'
def x(a, b = 12, &d)
end
pigeon%
Obviously, this would require some major changes to ruby. Also,
there might be performance penalties. For example, you would have
to store the names of all parameters with the method (though
that would be nice for introspection).
You already have the parameter symbols in the method definition.
def my_method( pos, width, height )
…
end
my_method( pos: 10, width: 20, height: 30 )
The place you don’t have them (at the moment) is with native C functions as
Ruby methods:
VALUE rb_my_method( VALUE self, VALUE arg1 )
{
…
}
Thinking aloud: would the argument order be taken care of at parsing time?
Obviously, this would require some major changes to ruby. Also,
there might be performance penalties. For example, you would have
to store the names of all parameters with the method (though
that would be nice for introspection).
You already have the parameter symbols in the method definition.
def my_method( pos, width, height )
…
end
my_method( pos: 10, width: 20, height: 30 )
The place you don’t have them (at the moment) is with native C functions as
Ruby methods:
VALUE rb_my_method( VALUE self, VALUE arg1 )
{
…
}
Thinking aloud: would the argument order be taken care of at parsing time?
The question being… what exactly is an implementation of Ruby? I
know this has come up before, but I still don’t have a handle on it.
That is a very good question. I think Matz’s implementation is Ruby with
lots of practical and script-useful add-ons. It’s an incredibly pragmatic
tool. A lot of this is owed to the language concepts.
But that just takes us back to the question: what is “Ruby”? In other
words: what is this antecedent, pure, Ur-Thing onto which Matz has
added all these other things? I can’t identify this thing, so I tend
to look at the distribution as definitively “Ruby” – not atomic (when
it comes to library stuff and extensions), but definitive in language
features.
Point is, because there’s only one implementation, there isn’t an
official(?) language standard yet. Ruby is not an academic ideal, it’s a
tangible tool.
Or: the standard could be defined as drop-in replaceability (in both
directions) for current stable Ruby. (Mind you, that’s unofficial
Or maybe passing the Rubicon test suite.
I’m hoping to implement a pure language version. No perlisms, no FileIO, no
SAFE, no threads, just classes, modules, arrays, strings…enough for the
language itself to be complete.
It all depends how you define “the language itself” Again, I tend
to define it as “this thing that Matz wrote and calls ‘Ruby’”.
Anyway, in case it’s not clear in the midst of all my ostensible
philosophizing, I do look forward to seeing the project.