Ruby Specifications

(Brian Mitchell) #1

Over the past few days I've been working on implementing my own (yet
another) Ruby interpreter. At first the simple things are easy to
match. With relative ease I was able to throw together modules,
classes, objects, and threads. However, moving further down this path
I am finding that ruby has an very complex trail of details in source
that have very slight but important effects.

If I am to match ruby as close as possible with this project I will
have to have a very deep understanding of the ruby code base.
Unfortunately, I am not able to read Japanese at a productive speed so
the black book is out of the question for a large part of this. The
other option I have is to pool the knowledge of the community to
successfully write a compatible interpreter.

Doing all of this alone would seem like a waste as there are many more
projects that set out to do many of the same things and many more that
would benefit from this information. What I am proposing is a
repository of sorts (a wiki perhaps) where we can maintain a
specification that is separate from implementation. It seems the days
of a single implementation are soon ending. I think this is a good
thing but without proper information we may run into portability
problems.

What do you guys think? Should we embrace a spec driven system or just
continue to use ruby as the reference implementation? Should we
continue our current ways but have a spec as further documentation?

Brian.

(Charles Steinman) #2

Brian Mitchell wrote:

What do you guys think? Should we embrace a spec driven system or just
continue to use ruby as the reference implementation? Should we
continue our current ways but have a spec as further documentation?

I don't think now is a very good time to write out a specification,
because the specifics are in flux as we move on to Ruby 2. Maybe once
the language is a little more stable again it would be a good idea.

In any case, I don't think we could ever have a purely spec-driven
system. If the specs were out of sync with Matz's Ruby, I imagine it
would be the specs that change, not Ruby. So it would mainly be a
descriptive thing. That's what I think.

#3

In article <fcfe41700508181054764fd3f9@mail.gmail.com>,

Over the past few days I've been working on implementing my own (yet
another) Ruby interpreter. At first the simple things are easy to
match. With relative ease I was able to throw together modules,
classes, objects, and threads. However, moving further down this path
I am finding that ruby has an very complex trail of details in source
that have very slight but important effects.

If I am to match ruby as close as possible with this project I will
have to have a very deep understanding of the ruby code base.
Unfortunately, I am not able to read Japanese at a productive speed so
the black book is out of the question for a large part of this. The
other option I have is to pool the knowledge of the community to
successfully write a compatible interpreter.

Doing all of this alone would seem like a waste as there are many more
projects that set out to do many of the same things and many more that
would benefit from this information. What I am proposing is a
repository of sorts (a wiki perhaps) where we can maintain a
specification that is separate from implementation. It seems the days
of a single implementation are soon ending. I think this is a good
thing but without proper information we may run into portability
problems.

What do you guys think? Should we embrace a spec driven system or just
continue to use ruby as the reference implementation? Should we
continue our current ways but have a spec as further documentation?

There are probably some good things that could come out of a spec-driven
system (as you imply, it would allow a thousands Ruby implementations to
bloom - errr, well, maybe that wouldn't be the best thing, come to think
of it, maybe 3 or 4 blooming Rubys would be sufficient.)

However (the big HOWEVER) realistically, I doubt we'll ever have a spec in
the form that you dream of. Right now the Ruby spec lives in Matz' brain
- and it is implemented in the current Ruby/C implementation.

I would suggest that perhaps we should view the current Ruby
implementation as an executable spec with a set of unit test cases
(Rubicon) that are used to verify it. Use the same unit tests to verify
your new implementation. Add unit tests where there are deficiencies.

A cautionary tale: There's a language for designing hardware called
Verilog. Back in the mid-90's the IEEE decided that there should be a
standardised Verilog specification. They made one, but there were lots of
holes in it. The first Verilog simulator was VerilogXL produced by a
company called Cadence. So what happens is that VerilogXL (being the
first implementation out there) is considered the gold standard. If your
new implementation doesn't match VerilogXL's results then it will probably
be considered wrong. But lots of arguing will ensue, of course, when
there are differences with the new implementor claiming that VerilogXL
does it wrong. All this to say that a written spec isn't always all that
useful and in fact it may be a waste of a lot of good energy that could be
focused in other areas.

Adding lots more testcases to Ruby's unit tests would probably be a good
way to go to acheive your goals.

Phil

···

Brian Mitchell <binary42@gmail.com> wrote:

(David A. Black) #4

Hi --

What do you guys think? Should we embrace a spec driven system or just
continue to use ruby as the reference implementation? Should we
continue our current ways but have a spec as further documentation?

My memory is that Matz said, at one or more of the RubyConfs, that he
himself did not intend to devote the time to writing a formal language
spec for Ruby but had no objection in principle if people wanted to.
I'm not sure whether he indicated he might grant it official status.

As others have said, I think the test suite is a key measure of what
something that claims to interpret Ruby should do.

David

···

On Fri, 19 Aug 2005, Brian Mitchell wrote:

--
David A. Black
dblack@wobblini.net

(Josh Charles) #5

I don't think now is a very good time to write out a specification,
because the specifics are in flux as we move on to Ruby 2. Maybe once
the language is a little more stable again it would be a good idea.

Is there a roadmap somewhere that contains a list of planned features
or what we might expect from further updates?

(Brian Mitchell) #6

This might be the exact reason to use specs. Forward looking
development would be part of a spec with an included set of RCRs. This
could then be matched by any implementation. It is a little more work
but it makes things easier to implement, follow, and understand IMO.

Wouldn't we want to make decisions on language merit rather than look
at current implementations for the easiest way to handle things?
Wouldn't Ruby 2 might be better as a spec first anyway? It can be
rather hard to follow all of the experimental features going in and
out of ruby. A spec would be an easy and evolving place to look.

Brian.

···

On 8/18/05, Charles Steinman <acharlieblue@gmail.com> wrote:

Brian Mitchell wrote:
> What do you guys think? Should we embrace a spec driven system or just
> continue to use ruby as the reference implementation? Should we
> continue our current ways but have a spec as further documentation?

I don't think now is a very good time to write out a specification,
because the specifics are in flux as we move on to Ruby 2. Maybe once
the language is a little more stable again it would be a good idea.

In any case, I don't think we could ever have a purely spec-driven
system. If the specs were out of sync with Matz's Ruby, I imagine it
would be the specs that change, not Ruby. So it would mainly be a
descriptive thing. That's what I think.

(Brian Mitchell) #7

In article <fcfe41700508181054764fd3f9@mail.gmail.com>,
>Over the past few days I've been working on implementing my own (yet
>another) Ruby interpreter. At first the simple things are easy to
>match. With relative ease I was able to throw together modules,
>classes, objects, and threads. However, moving further down this path
>I am finding that ruby has an very complex trail of details in source
>that have very slight but important effects.
>
>If I am to match ruby as close as possible with this project I will
>have to have a very deep understanding of the ruby code base.
>Unfortunately, I am not able to read Japanese at a productive speed so
>the black book is out of the question for a large part of this. The
>other option I have is to pool the knowledge of the community to
>successfully write a compatible interpreter.
>
>Doing all of this alone would seem like a waste as there are many more
>projects that set out to do many of the same things and many more that
>would benefit from this information. What I am proposing is a
>repository of sorts (a wiki perhaps) where we can maintain a
>specification that is separate from implementation. It seems the days
>of a single implementation are soon ending. I think this is a good
>thing but without proper information we may run into portability
>problems.
>
>What do you guys think? Should we embrace a spec driven system or just
>continue to use ruby as the reference implementation? Should we
>continue our current ways but have a spec as further documentation?
>

There are probably some good things that could come out of a spec-driven
system (as you imply, it would allow a thousands Ruby implementations to
bloom - errr, well, maybe that wouldn't be the best thing, come to think
of it, maybe 3 or 4 blooming Rubys would be sufficient.)

However (the big HOWEVER) realistically, I doubt we'll ever have a spec in
the form that you dream of. Right now the Ruby spec lives in Matz' brain
- and it is implemented in the current Ruby/C implementation.

I would suggest that perhaps we should view the current Ruby
implementation as an executable spec with a set of unit test cases
(Rubicon) that are used to verify it. Use the same unit tests to verify
your new implementation. Add unit tests where there are deficiencies.

Right. I guess some work could be done to expand those to complete
coverage (or close to that in the real world). I'll have to look
deeper at them having neglected that angle.

A cautionary tale: There's a language for designing hardware called
Verilog. Back in the mid-90's the IEEE decided that there should be a
standardised Verilog specification. They made one, but there were lots of
holes in it. The first Verilog simulator was VerilogXL produced by a
company called Cadence. So what happens is that VerilogXL (being the
first implementation out there) is considered the gold standard. If your
new implementation doesn't match VerilogXL's results then it will probably
be considered wrong. But lots of arguing will ensue, of course, when
there are differences with the new implementor claiming that VerilogXL
does it wrong. All this to say that a written spec isn't always all that
useful and in fact it may be a waste of a lot of good energy that could be
focused in other areas.

Adding lots more testcases to Ruby's unit tests would probably be a good
way to go to acheive your goals.

A very good thing to note. I think a spec should be fluid. That is,
you have some standard specs (1.8, 2.0) and then you append RCRs to
them to signify places you've taken the liberty to have some sort of
change. I view this more as a tool and a way to check behavior and
portability than a restraint.

I do think that this could be done successfully if enough rubyists
decided it is a good idea. It is a *big* undertaking but so is
managing a language that is growing at such an astounding rate (not
that I know much of anything from Matz's point of view).

Brian.

···

On 8/18/05, Phil Tomson <ptkwt@aracnet.com> wrote:

Brian Mitchell <binary42@gmail.com> wrote:

(Dion Almaer) #8

Who needs specs when you can just have exegenesis/apocalypse style fluffing
around? :slight_smile:

A spec would be good from a "business" sense. I know of a few large
companies that are worried about "betting on one Japanese fellow". Also, a
spec + test cases would be nice if we really want multiple programs which
grok ruby syntax (I just want one that runs on a VM [I know several are in
the works] :slight_smile:

On the other hand, I have seen far too much pain wrt specs and standards
bodies.

D

···

-----Original Message-----
From: Brian Mitchell [mailto:binary42@gmail.com]
Sent: Thursday, August 18, 2005 2:21 PM
To: ruby-talk ML
Subject: Re: Ruby Specifications

On 8/18/05, Phil Tomson <ptkwt@aracnet.com> wrote:
> In article <fcfe41700508181054764fd3f9@mail.gmail.com>,
> Brian Mitchell <binary42@gmail.com> wrote:
> >Over the past few days I've been working on implementing
my own (yet
> >another) Ruby interpreter. At first the simple things are easy to
> >match. With relative ease I was able to throw together modules,
> >classes, objects, and threads. However, moving further
down this path
> >I am finding that ruby has an very complex trail of
details in source
> >that have very slight but important effects.
> >
> >If I am to match ruby as close as possible with this
project I will
> >have to have a very deep understanding of the ruby code base.
> >Unfortunately, I am not able to read Japanese at a
productive speed
> >so the black book is out of the question for a large part of this.
> >The other option I have is to pool the knowledge of the
community to
> >successfully write a compatible interpreter.
> >
> >Doing all of this alone would seem like a waste as there are many
> >more projects that set out to do many of the same things and many
> >more that would benefit from this information. What I am
proposing is
> >a repository of sorts (a wiki perhaps) where we can maintain a
> >specification that is separate from implementation. It
seems the days
> >of a single implementation are soon ending. I think this is a good
> >thing but without proper information we may run into portability
> >problems.
> >
> >What do you guys think? Should we embrace a spec driven system or
> >just continue to use ruby as the reference implementation?
Should we
> >continue our current ways but have a spec as further documentation?
> >
>
> There are probably some good things that could come out of a
> spec-driven system (as you imply, it would allow a thousands Ruby
> implementations to bloom - errr, well, maybe that wouldn't
be the best
> thing, come to think of it, maybe 3 or 4 blooming Rubys would be
> sufficient.)
>
> However (the big HOWEVER) realistically, I doubt we'll ever have a
> spec in the form that you dream of. Right now the Ruby
spec lives in
> Matz' brain
> - and it is implemented in the current Ruby/C implementation.
>
> I would suggest that perhaps we should view the current Ruby
> implementation as an executable spec with a set of unit test cases
> (Rubicon) that are used to verify it. Use the same unit tests to
> verify your new implementation. Add unit tests where there
are deficiencies.
>

Right. I guess some work could be done to expand those to
complete coverage (or close to that in the real world). I'll
have to look deeper at them having neglected that angle.

>
> A cautionary tale: There's a language for designing hardware called
> Verilog. Back in the mid-90's the IEEE decided that there
should be a
> standardised Verilog specification. They made one, but there were
> lots of holes in it. The first Verilog simulator was VerilogXL
> produced by a company called Cadence. So what happens is that
> VerilogXL (being the first implementation out there) is
considered the
> gold standard. If your new implementation doesn't match
VerilogXL's
> results then it will probably be considered wrong. But lots of
> arguing will ensue, of course, when there are differences
with the new
> implementor claiming that VerilogXL does it wrong. All this to say
> that a written spec isn't always all that useful and in
fact it may be
> a waste of a lot of good energy that could be focused in
other areas.
>
> Adding lots more testcases to Ruby's unit tests would probably be a
> good way to go to acheive your goals.
>

A very good thing to note. I think a spec should be fluid.
That is, you have some standard specs (1.8, 2.0) and then you
append RCRs to them to signify places you've taken the
liberty to have some sort of change. I view this more as a
tool and a way to check behavior and portability than a restraint.

I do think that this could be done successfully if enough
rubyists decided it is a good idea. It is a *big* undertaking
but so is managing a language that is growing at such an
astounding rate (not that I know much of anything from Matz's
point of view).

Brian.

(Alexandru Popescu) #9

#: Dion Almaer changed the world a bit at a time by saying on 8/18/2005 9:33 PM :#
  > On the other hand, I have seen far too much pain wrt specs and standards

bodies.

D

I think I am aware of who/what are you talking :-). But I would say that even a spec would break the `most expected behavior´ nature of Ruby, it can bring a lot of good things (including the ones you already mentioned - and I think more trust in it - not that Matz is not enough :slight_smile: ).

I think that this way the community will be able to focus and speed up on obtaining more stable and different environments. Also from the point of view of post-newbies this can represent a very nice reference.

I am aware of the fact that this may represent a huge effort and would most probably require Matz' full commitment, but I still think that it will pay back ;-).

:alex |.::the_mindstorm::.|

···

-----Original Message-----
From: Brian Mitchell [mailto:binary42@gmail.com] Sent: Thursday, August 18, 2005 2:21 PM
To: ruby-talk ML
Subject: Re: Ruby Specifications

On 8/18/05, Phil Tomson <ptkwt@aracnet.com> wrote:
> In article <fcfe41700508181054764fd3f9@mail.gmail.com>,
> Brian Mitchell <binary42@gmail.com> wrote:
> >Over the past few days I've been working on implementing my own (yet
> >another) Ruby interpreter. At first the simple things are easy to > >match. With relative ease I was able to throw together modules, > >classes, objects, and threads. However, moving further down this path > >I am finding that ruby has an very complex trail of details in source > >that have very slight but important effects.
> >
> >If I am to match ruby as close as possible with this project I will > >have to have a very deep understanding of the ruby code base.
> >Unfortunately, I am not able to read Japanese at a productive speed > >so the black book is out of the question for a large part of this. > >The other option I have is to pool the knowledge of the community to > >successfully write a compatible interpreter.
> >
> >Doing all of this alone would seem like a waste as there are many > >more projects that set out to do many of the same things and many > >more that would benefit from this information. What I am proposing is > >a repository of sorts (a wiki perhaps) where we can maintain a > >specification that is separate from implementation. It seems the days > >of a single implementation are soon ending. I think this is a good > >thing but without proper information we may run into portability > >problems.
> >
> >What do you guys think? Should we embrace a spec driven system or > >just continue to use ruby as the reference implementation? Should we > >continue our current ways but have a spec as further documentation?
> >
> > There are probably some good things that could come out of a > spec-driven system (as you imply, it would allow a thousands Ruby > implementations to bloom - errr, well, maybe that wouldn't be the best > thing, come to think of it, maybe 3 or 4 blooming Rubys would be > sufficient.)
> > However (the big HOWEVER) realistically, I doubt we'll ever have a > spec in the form that you dream of. Right now the Ruby spec lives in > Matz' brain
> - and it is implemented in the current Ruby/C implementation.
> > I would suggest that perhaps we should view the current Ruby > implementation as an executable spec with a set of unit test cases
> (Rubicon) that are used to verify it. Use the same unit tests to > verify your new implementation. Add unit tests where there are deficiencies.
>

Right. I guess some work could be done to expand those to complete coverage (or close to that in the real world). I'll have to look deeper at them having neglected that angle.

> > A cautionary tale: There's a language for designing hardware called > Verilog. Back in the mid-90's the IEEE decided that there should be a > standardised Verilog specification. They made one, but there were > lots of holes in it. The first Verilog simulator was VerilogXL > produced by a company called Cadence. So what happens is that > VerilogXL (being the first implementation out there) is considered the > gold standard. If your new implementation doesn't match VerilogXL's > results then it will probably be considered wrong. But lots of > arguing will ensue, of course, when there are differences with the new > implementor claiming that VerilogXL does it wrong. All this to say > that a written spec isn't always all that useful and in fact it may be > a waste of a lot of good energy that could be focused in other areas.
> > Adding lots more testcases to Ruby's unit tests would probably be a > good way to go to acheive your goals.
>

A very good thing to note. I think a spec should be fluid. That is, you have some standard specs (1.8, 2.0) and then you append RCRs to them to signify places you've taken the liberty to have some sort of change. I view this more as a tool and a way to check behavior and portability than a restraint.

I do think that this could be done successfully if enough rubyists decided it is a good idea. It is a *big* undertaking but so is managing a language that is growing at such an astounding rate (not that I know much of anything from Matz's point of view).

Brian.

#10

In article <20050818193338.C0A2533D5F@beryllium.ruby-lang.org>,

Who needs specs when you can just have exegenesis/apocalypse style fluffing
around? :slight_smile:

A spec would be good from a "business" sense. I know of a few large
companies that are worried about "betting on one Japanese fellow".

I don't get it, what's the issue? Ruby as it exists in it's current form
is usable - How would a language spec make them feel any better? I could
see it if Ruby wasn't open source - then Matz could disappear and the
source code with him. But since the Ruby source is all over the place
even if Matz were to disappear (heaven forbid) Ruby would still be around
and usable.

Phil

···

Dion Almaer <dion@almaer.com> wrote:

(Lothar Scholz) #11

Hello Phil,

In article <20050818193338.C0A2533D5F@beryllium.ruby-lang.org>,

Who needs specs when you can just have exegenesis/apocalypse style fluffing
around? :slight_smile:

A spec would be good from a "business" sense. I know of a few large
companies that are worried about "betting on one Japanese fellow".

I don't get it, what's the issue? Ruby as it exists in it's current form
is usable - How would a language spec make them feel any better? I could

I think a language needs a formal specification.

If you have mission critical applications it's a little bit hard to
take this "C is the specification" argument.

I posted into the past that i really don't like it that matz break
compatibility in minor release changes. Suddenly returning a "[]" instead
of "nil" might be a small change but it can cost millions of dollars if it
happens in a critical environment.

If we had a specification for this it might restrict matz to make
changes like this, just because it feels better. This works for a
hacker language but i know that many companies got afraid when hearing
about this.

···

Dion Almaer <dion@almaer.com> wrote:

--
Best regards, emailto: scholz at scriptolutions dot com
Lothar Scholz http://www.ruby-ide.com
CTO Scriptolutions Ruby, PHP, Python IDE 's

(Alexandru Popescu) #12

#: Phil Tomson changed the world a bit at a time by saying on 8/18/2005 11:26 PM :#

In article <20050818193338.C0A2533D5F@beryllium.ruby-lang.org>,

Who needs specs when you can just have exegenesis/apocalypse style fluffing
around? :slight_smile:

A spec would be good from a "business" sense. I know of a few large
companies that are worried about "betting on one Japanese fellow".

I don't get it, what's the issue? Ruby as it exists in it's current form is usable - How would a language spec make them feel any better?

How can you convince/decide to invest/base your company when a change in the environment/language can break your products?

How can you decide that an alternative env will serve you better when you cannot decide right from the start that it offers at least the compatibility with the default Ruby?

Being around for some time I started to think that the most important asset of Ruby is Matz' head. Sharing his ideas on some documents will make some of us feel better.

:alex |.::the_mindstorm::.|

···

Dion Almaer <dion@almaer.com> wrote:

I could see it if Ruby wasn't open source - then Matz could disappear and the source code with him. But since the Ruby source is all over the place even if Matz were to disappear (heaven forbid) Ruby would still be around and usable.

Phil

(Jonas Pfenniger) #13

It could be intereting to make specifications, it could show where the
inconsistencies in the language are. This depends on how they are made.
In my experience, a text representation makes it difficult to link
foreign parts together, because my brain's buffer just isn't big enough
to contain the whole specs. Is it possible to have a visual expression
of the docs ?

In a similar context, I really like the Io grammar diagramm[1]. Does
anybody plan to do this for ruby ?

Cheers,
.... zimba

[1] http://www.iolanguage.com/docs/diagrams/grammar/

(Tesla) #14

Lothar Scholz wrote:

Hello Phil,

In article <20050818193338.C0A2533D5F@beryllium.ruby-lang.org>,

Who needs specs when you can just have exegenesis/apocalypse style fluffing
around? :slight_smile:

A spec would be good from a "business" sense. I know of a few large
companies that are worried about "betting on one Japanese fellow".
     
I don't get it, what's the issue? Ruby as it exists in it's current form
is usable - How would a language spec make them feel any better? I could

I think a language needs a formal specification.

If you have mission critical applications it's a little bit hard to
take this "C is the specification" argument.

I posted into the past that i really don't like it that matz break
compatibility in minor release changes. Suddenly returning a "[]" instead
of "nil" might be a small change but it can cost millions of dollars if it
happens in a critical environment.

If we had a specification for this it might restrict matz to make
changes like this, just because it feels better. This works for a
hacker language but i know that many companies got afraid when hearing
about this.

I think this is one of the reasons that PHP is controlled mostly by Zend and the reason for Zend being. There was a great deal of compatiblity issues surrounding the upgrading of php4 to OOP. The result was PHP5 and the transistion to php5 from php4 is gradual and not mandatory (although I think php4 is at the end of its cycle) for companies that have major investments in PHP. So if Matz is thinking of making some heavy changings that are outside of a spec then it would be cause for a branch of Ruby rather than a teardown and the problems that come with it.

This is the one major problem I have with the Drupal CMS project. Point version changes are major swings from the previous ones and cause a tidelwave of work every 6 months. This means that companies will continue to go with "enterprise" ready solutions like Typo3 and ezPublish where the dev cycle is on point versions but major changes without backwards compatiblity are very few.

My own selfish wish is that the Ruby dev mailing list be in english so I can see what the core developers are working on.

···

Dion Almaer <dion@almaer.com> wrote:

--

Tesla -