Ruby Specification

D

David Ross

Request. Can someone create a ruby specification? I
want to try to create a true rubycc compiler that is
licensed BSD. I cannot find the Ruby Specification
book anywhere, and I refuse to read the ruby sources
for legal reasons. Anyone want to read up on gc.c?
Thats mainly the monster. It would be nice to have a
full specification on ruby though. Also, if there are
any compiler designers out there that would like to
help or have any comments, drop me an email. Thanks. I
would really like to create a compiler that generates
small executables. It is important to expanding ruby
IMO. Something in the essence of how Lua has a
compiler. It would be really nice. Also, thanks to
that there is no ruby compiler I could not use it in a
commercial project. It would have been really nice to
use it in projects that require a compiled binary that
is 1) not open code, 2) not byte compiled. Please
advise, David Ross



__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
 
L

Lothar Scholz

Hello David,

DR> Request. Can someone create a ruby specification? I
DR> want to try to create a true rubycc compiler that is
DR> licensed BSD. I cannot find the Ruby Specification
DR> book anywhere, and I refuse to read the ruby sources
DR> for legal reasons. Anyone want to read up on gc.c?
DR> Thats mainly the monster. It would be nice to have a

That's a typo, the monster is "eval.c".
Reading the "gc.c" file is as enjoying as reading Harry Potter.

DR> full specification on ruby though. Also, if there are
DR> any compiler designers out there that would like to
DR> help or have any comments, drop me an email. Thanks. I
DR> would really like to create a compiler that generates
DR> small executables. It is important to expanding ruby
DR> IMO. Something in the essence of how Lua has a
DR> compiler. It would be really nice. Also, thanks to
DR> that there is no ruby compiler I could not use it in a
DR> commercial project. It would have been really nice to
DR> use it in projects that require a compiled binary that
DR> is 1) not open code, 2) not byte compiled. Please
DR> advise, David Ross

This is a huge project that you want to start. And in 99% projects of
this size die faster then a local minister in iraq, leaving a lot
of wasted energy.

You should think twice if it is not better to support matz with doing
a rewrite of the current interpreter to get byte code for code obfuscation.
Because of the dynamic nature of Ruby and the interface it provides to
open languages you have to rewrite more or less the whole kernel
anyway. So please participate in the development of Rite.

There is no legal problem with using ruby in commercial projects,
otherwise matz would not be paid by his company.

And by the way, do you want to do this as part of some kind of job or
as a hobbyist ?
 
G

Gully Foyle

David said:
Request. Can someone create a ruby specification? I
want to try to create a true rubycc compiler that is
licensed BSD. I cannot find the Ruby Specification
book anywhere, and I refuse to read the ruby sources
for legal reasons. Anyone want to read up on gc.c?
Thats mainly the monster. It would be nice to have a
full specification on ruby though. Also, if there are
any compiler designers out there that would like to
help or have any comments, drop me an email. Thanks. I
would really like to create a compiler that generates
small executables. It is important to expanding ruby
IMO. Something in the essence of how Lua has a
compiler. It would be really nice. Also, thanks to
that there is no ruby compiler I could not use it in a
commercial project. It would have been really nice to
use it in projects that require a compiled binary that
is 1) not open code, 2) not byte compiled. Please
advise, David Ross



__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

Wow. I wish you the best of luck!

Many of us would be overjoyed to see a true rubycc. Even if its kinda
like gcj with a huge runtime library. And the BSD style licensing makes
it sound almost too good to be true.

If this gets started and you need volunteers, I'm sure you'll find many
ready and willing.
 
G

gabriele renzi

Request. Can someone create a ruby specification? I
want to try to create a true rubycc compiler that is
licensed BSD. I cannot find the Ruby Specification
book anywhere, and I refuse to read the ruby sources
for legal reasons.

I understand your reasons, but I think you can look at parse.y and
refer to the ri documentation for most things, safely.
Matz' company is definitely not SCO, I believe.

Anyone want to read up on gc.c?

I dont think tha gc is part of a ruby specification.
Maybe you intended eval.c ?
Thats mainly the monster. It would be nice to have a
full specification on ruby though.

matz itself agrees, and he told once that he would bless someone that
wants to fill this gap.
Also, if there are
any compiler designers out there that would like to
help or have any comments, drop me an email. Thanks. I
would really like to create a compiler that generates
small executables.

maybe you'd like to take a look at metaruby or jruby.
It is important to expanding ruby
IMO. Something in the essence of how Lua has a
compiler. It would be really nice.

it would, but you'd need some interpreter runtime anyway.
Maybe you could compile to C code and link the ruby runtime library
Also, thanks to
that there is no ruby compiler I could not use it in a
commercial project.

if you mean you need to hide/obfuscate code, maybe you just need a
vm+bytecode, as lothar scholz pointed.
It would have been really nice to
use it in projects that require a compiled binary that
is 1) not open code, 2) not byte compiled. Please
advise, David Ross

why not byte compiled? there are plenty of java and smalltalk
commercial apps.
 
D

David Ross

I understand your reasons, but I think you can look
at parse.y and
refer to the ri documentation for most things,
safely.
Matz' company is definitely not SCO, I believe.
I hope they are not SCO. I refuse to look at any
source code though.
I don't think that gc is part of a ruby specification.
Maybe you intended eval.c ?
I should have said, "I do not understand the GC, and
parsing evaluations are a task as well. To start
though I need to know how ruby is expected to work.
Each language GC is different, but performs the same
task.

it would, but you'd need some interpreter runtime
anyway.
Maybe you could compile to C code and link the ruby
runtime library

yes, you would need a runtime. I have not planned
anything out yet, its in the idea stage.

if you mean you need to hide/obfuscate code, maybe
you just need a
vm+bytecode, as lothar scholz pointed.

I really do not like compiling software into bytecode.
They wanted a standalone executable, they did not want
any third party interpreters.

-------

Okay in response to a few things that have been
mentioned to me elsewhere. Even with dynamic nature of
ruby, it is still possible to create a native
compiler. You have to have a runtime running with it.
It is difficult, and certainly something that would
take a while. I'm tired of hearing, "It can't be done"
in software programming. Just because people think it
cannot be done doesn't mean they are right about it.

Why create a compiler to create stand alone
executables?

I find it difficult to have third part software
installed on the computer. Also, if someone wants to
include an application on a OS which I will not
mention, they want a standalone that does not need a
interpreter. This is one of the main reasons.

--David Ross



__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/
 
L

Lothar Scholz

Hello David,


DR> I really do not like compiling software into bytecode.
DR> They wanted a standalone executable, they did not want
DR> any third party interpreters.

You can have all in one interpreter binary, even DLL's. That is for
these people just the same.

DR> Okay in response to a few things that have been
DR> mentioned to me elsewhere. Even with dynamic nature of
DR> ruby, it is still possible to create a native
DR> compiler. You have to have a runtime running with it.
DR> It is difficult, and certainly something that would
DR> take a while. I'm tired of hearing, "It can't be done"
DR> in software programming. Just because people think it
DR> cannot be done doesn't mean they are right about it.

Oh, i don't say this. I just say that compiling it will not give you
any real advantage as long as you don't add type specifications to the
language. Otherwise the compiler would only have a very very small
performance advantage.

The only way to get some benefits is if you can assume that the system
is closed, means that now new ruby files are loaded and no internal
program structure is changed, D, Eiffel and some Lisps are taking
this approach, it's called global program optimization and can give
a huge boost in evaluation speed because accessing a variable or
calling a method can be as fast as a native function call.
But is this restriction really usefull ?

I don't have the time to go into a deep description of how to solve this
problems with a good JIT compiler. So maybe you should read some texts
about this first.

DR> Why create a compiler to create stand alone
DR> executables?

DR> I find it difficult to have third part software
DR> installed on the computer. Also, if someone wants to
DR> include an application on a OS which I will not
DR> mention, they want a standalone that does not need a
DR> interpreter. This is one of the main reasons.

Right, but ExErb is just doing this. It's not a compiler, it does
exist and is a living project and it is in real life usage.
So this is not an argument for a compiler. If you are unsatisfied with
ExErb please spend your time there.
 
G

gabriele renzi

il Tue, 20 Jul 2004 00:17:13 +0900, David Ross <[email protected]>
ha scritto::

I should have said, "I do not understand the GC, and
parsing evaluations are a task as well. To start
though I need to know how ruby is expected to work.
Each language GC is different, but performs the same
task.

yes but I intended: "you can have your own kind of gc, because ruby
garbage collection does not really determine the behaviour of a
program".
If you have 3-color generational gc or simple reference counting with
cycle detection I think that nothing will change for the final user.
Anyway, I may be wrong.
 
M

Mark Sparshatt

yes but I intended: "you can have your own kind of gc, because ruby
garbage collection does not really determine the behaviour of a
program".
If you have 3-color generational gc or simple reference counting with
cycle detection I think that nothing will change for the final user.
Anyway, I may be wrong.
I think changing to a reference counting GC system would change the
behaviour of the program, since it would change when an object is collected.

I know that this subtlety has caused problems for people moving from
CPython (Which uses reference counting) to Jython (which uses mark and
sweep)
 
B

Bill Kelly

Hi,

From: "David Ross said:
Request. Can someone create a ruby specification? I
want to try to create a true rubycc compiler that is
licensed BSD.

Please don't take this as a criticism. I am asking
because I thought Ruby's license was said to allow
commerical exploitation (even closed source). And
so I'm curious if this is your impression too, or what
additional safeguards or clauses make the BSD license
preferable for your purposes?
I cannot find the Ruby Specification
book anywhere, and I refuse to read the ruby sources
for legal reasons.

I find this perplexing. I thought open source
wasn't doing a good job of being open source if you
had to be wary of reading it for legal reasons?

An example in my field of interest is id Software's
generous release of their older game engines, such as
DOOM, Quake, and Quake 2 under the GPL. I was a game
developer when the Quake source was released, and it
never would have occurred to me to be afraid to look
at it.

Anyway, again, this is not intended as a criticism -
I'm just trying to understand what could possibly be
wrong with looking at Ruby's source code.


Regards,

Bill
 
D

David Ross

Please don't take this as a criticism. I am asking
because I thought Ruby's license was said to allow
commerical exploitation (even closed source). And
so I'm curious if this is your impression too, or
what
additional safeguards or clauses make the BSD
license
preferable for your purposes?

I find this perplexing. I thought open source
wasn't doing a good job of being open source if you
had to be wary of reading it for legal reasons?

I want to make sure my code stays under the BSD
license. Ruby's license confuses me a bit. --David Ross



__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
 
J

Jeremy Henty

(Disclaimer: the isn't really (directly) about Ruby, so you may think
it off-topic. But it is (indirectly) about the consequences of
looking at the Ruby source, so I hope it is on-topic.)

I thought open source wasn't doing a good job of being open source
if you had to be wary of reading it for legal reasons?

"Open source" only means "you have the right to do certain things with
this software". It does *not* mean "you can do whatever you like with
it and not worry about the consequences". *That* is only true of
software released into the public domain.
An example in my field of interest is id Software's generous release
of their older game engines, such as DOOM, Quake, and Quake 2 under
the GPL. I was a game developer when the Quake source was released,
and it never would have occurred to me to be afraid to look at it.

Pardon my bluntness, but that was foolish of you. The GPL requires
you to release all derived works under the GPL too. If you looked at
id Software's source and used it in a closed source product of your
own then id Software would have grounds for suing you for damages.

I am not accusing you of trying to rob id Software (nor am I accusing
id Software of being litigious <disrespectful_term>s). I just want to
point out that good intentions may not be enough to keep you out of
court. Companies have sued ex-employees simply for working in the
same industry, claiming "inevitable disclosure" ie. "this person
learned their skills with us, so if they use those skills elsewhere
they are violating our IP rights". I don't condone their behaviour (I
actually find it loathsome), but the practical upshot is that if you
don't like the idea of being sued by people with much more lawyers and
money than you then you should think very hard about the licenses of
any software you look at.
Anyway, again, this is not intended as a criticism - I'm just trying
to understand what could possibly be wrong with looking at Ruby's
source code.

Nothing, as long as you conform to its license. But if the OP wants
to release code under the BSD license and is not sure whether the Ruby
license is BSD-compatible, then the OP's decision not to look at the
Ruby source is IMHO extremely sensible.

Regards,

Jeremy Henty
 
K

Kristof Bastiaensen

On Mon, 19 Jul 2004 18:51:46 +0000, Jeremy Henty wrote:

Hi,
Pardon my bluntness, but that was foolish of you. The GPL requires
you to release all derived works under the GPL too. If you looked at
id Software's source and used it in a closed source product of your
own then id Software would have grounds for suing you for damages.

I am not a lawyer, but I believe this is not correct.
As far as I know, copyright only applies to the code, not to
the techniques used. So as long as you are not
copying code directly into your program, you are not in breach
of copyright. For the GPL a derived work is only derived if it
uses the same code. Techniques don't fall under copyright,
but under patent law. (Wether patents should be allowed for
software is a different discussion).
Of course you could copy the code, change the names of some
variables and functions, and then claim it's your code, but
this would obviously still fall under the copyright case.
However if you just look at the techniques used, and use
them in you code (not verbatim), then there wouldn't be any
grounds to be sued (apart from patents).

Kristof
 
G

gabriele renzi

il Tue, 20 Jul 2004 02:49:00 +0900, Mark Sparshatt
I think changing to a reference counting GC system would change the
behaviour of the program, since it would change when an object is collected.

I know that this subtlety has caused problems for people moving from
CPython (Which uses reference counting) to Jython (which uses mark and
sweep)

CPython does reference count, while JPython should use the jvm's GC.

This problem may appear when going from refcount to gc, cause you may
expect that an object gets gc'ed at the end of a code block (in ref
count)while it does not (gc).
OTOH, when you're expecting a general GC behaviour you don't make
assumptions about the automatic deletion of an object, so this problem
does not arise. At least, I think.
 
B

Bill Kelly

Hi,

From: "Jeremy Henty said:
(Disclaimer: the isn't really (directly) about Ruby, so you may think
it off-topic. But it is (indirectly) about the consequences of
looking at the Ruby source, so I hope it is on-topic.)



"Open source" only means "you have the right to do certain things with
this software". It does *not* mean "you can do whatever you like with
it and not worry about the consequences". *That* is only true of
software released into the public domain.

Certainly. I thought that copyright law (IANAL) distinguished
between modifying someone else's code (derivative work) and
writing your own code from scratch. I have seen *a lot* of code
in my life so far, much of it proprietary and closed source.
You aren't supposed to be able to copyright an *idea*. That's
what Software Patents do (and I think they are an abomination,
but that's a different topic.) My point is that I don't live
in fear that I might accidentally "steal" someone else's code
just because I've looked at it. I know the difference between
"copying someone else' code modifying it" vs. "implementing my
own code from scratch based on all the knowledge I've picked up
over my career."

I guess I'm approaching this using my own GPL software as a
yardstick - would I care if someone learned from my GPL code,
and then decided to re-implement the same functionality from
scratch, just using what they'd learned? No! I'd be thrilled
that my code was useful to someone. That's why I released it!!
Pardon my bluntness, but that was foolish of you.

No worries, I'm here to learn . . .
The GPL requires
you to release all derived works under the GPL too. If you looked at
id Software's source and used it in a closed source product of your
own then id Software would have grounds for suing you for damages.

Apologies if this is getting too off-topic... But here is an
excerpt from id Software's release of the Quake 2 code:

The code is all licensed under the terms of the GPL (gnu public license).
You should read the entire license, but the gist of it is that you can do
anything you want with the code, including sell your new version. The catch
is that if you distribute new binary versions, you are required to make the
entire source code available for free to everyone.

The primary intent of this release is for entertainment and educational
purposes, but the GPL does allow commercial exploitation if you obey the
full license.

I firmly believe id Software's intent was not to say: Here's our
code for you to learn from! DON'T LOOK AT IT!!!!!!!!!!!!!!!!!

I truly do not believe the purpose of their releasing their code
was to try to drum up lawsuits against anyone who might have wanted
to learn from it.
I am not accusing you of trying to rob id Software (nor am I accusing
id Software of being litigious <disrespectful_term>s). I just want to
point out that good intentions may not be enough to keep you out of
court. Companies have sued ex-employees simply for working in the
same industry, claiming "inevitable disclosure" ie. "this person
learned their skills with us, so if they use those skills elsewhere
they are violating our IP rights". I don't condone their behaviour (I
actually find it loathsome), but the practical upshot is that if you
don't like the idea of being sued by people with much more lawyers and
money than you then you should think very hard about the licenses of
any software you look at.

OK. But perhaps we can take this on a case-by-case basis? Meaning,
We're talking about Matz here, (and in my examples, John Carmack).

I am personally willing to trust that I understand the intent of
id Software releasing their code. And that for people to be afraid
to look at it for fear of getting sued based on what they learned from
it, is COMPLETELY CONTRARY to that intent. (Again I'm distinguishing
between learning from the code, and *copying* it.)

Oh well, that's just me. I think there's something a little sad
about all this though... (Maybe our nations should cease development
of missile defense shields, and start working on lawyer containment
mechanisms... ;-P)


Regards,

Bill
 
M

Mark Sparshatt

gabriele said:
il Tue, 20 Jul 2004 02:49:00 +0900, Mark Sparshatt
<[email protected]> ha scritto::




CPython does reference count, while JPython should use the jvm's GC.

This problem may appear when going from refcount to gc, cause you may
expect that an object gets gc'ed at the end of a code block (in ref
count)while it does not (gc).
OTOH, when you're expecting a general GC behaviour you don't make
assumptions about the automatic deletion of an object, so this problem
does not arise. At least, I think.
The problem would come if someone did release an alternate
implementation of Ruby with reference counting GC. Then if people who
were used to alternate Ruby moved to standard ruby they might expect the
same behaviour, and assume it's a bug when standard ruby behaves
differently.
 
J

James Britt

David said:
...
Why create a compiler to create stand alone
executables?

I find it difficult to have third part software
installed on the computer. Also, if someone wants to
include an application on a OS which I will not
mention, they want a standalone that does not need a
interpreter. This is one of the main reasons.

Not sure why you are so reluctant to mention an OS, or look at certain
source code; quite mysterious. But on Windows, for example, the
requirement for an interpreter or runtime engine is quite common. Any
Java(tm) app needs a VM installed. VB apps (pre .Net) require some
version of vbrun.dll.

Sometimes these things are already installed, sometimes not. But once
installed they are available for other applications as well.

Plus, one can bundle up the Ruby interpreter into an executable using
exerb. Makes the app larger, but still probably smaller than your
typical "stand-alone" Java(tm) program.



James
 
J

Joel VanderWerf

Mark said:
The problem would come if someone did release an alternate
implementation of Ruby with reference counting GC. Then if people who
were used to alternate Ruby moved to standard ruby they might expect the
same behaviour, and assume it's a bug when standard ruby behaves
differently.

In my understanding, ruby makes no guarantees about memory management,
except that unreferenced objects will eventually get recycled. A ruby
specification should state explicitly that, aside from this guarantee,
behavior is unspecified.

Of course, if programmers don't read the spec, they can still get bitten...
 
G

gabriele renzi

il Tue, 20 Jul 2004 05:05:38 +0900, Mark Sparshatt
The problem would come if someone did release an alternate
implementation of Ruby with reference counting GC. Then if people who
were used to alternate Ruby moved to standard ruby they might expect the
same behaviour, and assume it's a bug when standard ruby behaves
differently.

agreed, but given that current alghoritm is known (mark&sweep, unknown
GC runs) I suppose the OP does not need to dwell in the internals of
gc.c. Just my thought, anyway
 
A

Anders K. Madsen

On Tue, 20 Jul 2004 03:00:44 +0900

[snippety-snip]
I want to make sure my code stays under the BSD
license. Ruby's license confuses me a bit. --David Ross

Ehrm, this is just a suggestion, I'm not really into the whole licensing
thingy, so this might not be a solution.
But, why not get into a dialogue with matz about this?
I mean, he must know what's right and wrong regarding the Ruby License.

And just a little note.
I don't see why some people (e.g. Lothar) makes a problem out of someone
wanting to make rubycc. IMO a Ruby compiler wouldn't hurt anyone. Even
if there are some approximating the functionality around already. If
they dislike this project, they should just ignore it and stop being so
damn negative about it! It's not a very creative approach to anything!

I'd love to help, but unfortunately I'm most certainly not skilled
enough for such a project.

Best regards and good luck on the project!

Madsen

--
Anders K. Madsen --- http://lillesvin.linux.dk

"There are 10 types of people in the world.
Those who understand binary - and those who don't."

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFA/MSplNHJe/JASHcRAguEAJ9L/vZzBGythQkCxCHND9CwL7LkFQCcDYk3
lDrNYR2yDieLJeatbGboTvc=
=E7/4
-----END PGP SIGNATURE-----
 
G

gabriele renzi

And just a little note.
I don't see why some people (e.g. Lothar) makes a problem out of someone
wanting to make rubycc. IMO a Ruby compiler wouldn't hurt anyone. Even
if there are some approximating the functionality around already. If
they dislike this project, they should just ignore it and stop being so
damn negative about it! It's not a very creative approach to anything!

I don't think people is being "damn negative". I think everybody would
agree that having a fastlight ruby compiler with type inference,
runtime hotspot detection and magic based garbage collection would be
nice.

People (me) is just pointing out that this is quite hard (as
Cardinal, Carbone, MetaRuby, YARV, netruby and others show, ending
such a task is really difficult, starting it is not), and that maybe
time could be used working on matz' ruby instead of restarting from
scratch.
In the end I wish David Ross best luck for his own implementation,
I'll be pleased to use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top