Do any languages have an equivalent of Ruby's RubySpec project?
Is Ruby the only language that has a test suite describing the language, or has 开发者_如何学Cthe idea spread to other languages?
Is Ruby the only language that has a test suite describing the language, or has the idea spread to other languages?
You may have the direction reversed, you know. Perl has a couple different such test suites, both incredibly extensive, just massive beyond belief.
For the first, Perl₅ does execute — um, let’s see now […time passes…] 416172 (~4e5) separate tests when you type make test
. These tests include those for the language itself and for the standard library that Perl ships with.
% make test
[…]
All tests successful.
u=4.39 s=2.85 cu=422.24 cs=59.61 scripts=1853 tests=416172
433.328u 65.845s 12:19.59 67.4% 0+0k 1587+2563io 4pf+0w
Certainly that’s been around for much longer than Ruby has existed.
But I think what you’re talking about may be more like Perl₆’s test suite, which is a rather more formal arrangement based on the spec. This has only been around — well, growing — for the last decade or so, though.
Perl and Python both have test suites for their various implementations.
There is one important difference between langauges to note: Languages defined by reference implementation and languages defined by a standard. Many langauges have standards: C, C++, Java, Haskell, Smalltalk, only to name a few.
Languages that have a standard are less likely to have a project like RubySpec, because their language is already sufficiently defined by the standard.
There are some languages that are mostly defined by a reference implementation. I know of these languages: Ruby, Python, Perl, PHP
As far as I have found out the most similar project to RubySpec is roast for Perl.
Python has many implementations too, but they do not have a project to share their language tests, which, I am sure, all the projects have. I think this may be due to the fact that Python has a detailed language reference, which is almost equal to a standard.
There is at least one implementation of PHP in Java. There probably are some language specs for PHP but no project like RubySpec either.
The special case for RubySpec is, that Ruby does not have a standard. It is only defined by the reference implementation MRI. Therefore RubySpec aims to create a specification through tests. Unfortunately most of the core developers of MRI are not participating in RubySpec. There are some criticisms of RubySpec and so RubySpec is not accepted by MRI. I really recommend the Interview with Brian Shirai on the Ruby Design Process
EDIT:
Concerining a standard for Ruby:
Ruby was specified through JIS in 2011 and by ISO/IEC in 2012. At least that is what it says on this Wikipedia page. I have not been able to read this standard though, since you need to buy it to do so. This gives a little amount of information about the standard too.
So in fact I have not expressed myself correctly. There is some standard now, but that is still not, what is being used by the various reimplementations of Ruby. I cannot say why exactly, because I could not read the standard, but I think it is because the standard describes too little of the language. Too little of what is being used by all the gems for Ruby.
A standard for Ruby has been missing for such a long time, that a lot of behavior from MRI became the expected behavior and in fact part of what the users(meaning ruby programmers) expect the language to do. It is hard to say what belongs to the language and what is implementation detail. I also recommend this talk given by Brian Shirai(formerly Ford) he gave at RubyConf 2012.
FUrthermore MRI has many features and the development is still going on. Ruby 2.0.0 has been released which has many new features. I don't think these features are part of the standard yet.
So I think the standard by ISO/IEC is not an appropriate standard for the Ruby programming language.
I have been working on MagLev, an alternative ruby implementation for the last year. Right now I am writing my Bachelor's Thesis which is why I have investigated a lot in this topic.
精彩评论