Someone asked about the splat operator yesterday, and I wanted to see the source code... would that be written in C or in Ruby? Where would it be found?
+4
A:
Some quick Google searching turned up that it's implemented in eval.c. You can find references to "splat" in a few places in the file, but I'm not familiar enough with the inner workings of Ruby to make any sense of it.
Martin Gordon
2009-05-28 15:30:58
Thanks for that, Martin. Just trying to make sense of the Ruby world. So basically, if it's ruby and not rails, the source is probably not in Ruby, which makes sense.
Yar
2009-05-28 18:27:58
The splat operator is part of the core ruby language, not a library feature. It can be used on any object that defines a #to_ary method, but when used to collect multiple values into a single variable (as in `a, *b = 1,2,3,4,5`) it will always create an Array.
rampion
2009-05-28 19:05:57
@Rampion, thanks for that. So I guess my real question would be: are there any "library features" (for which the source code is in Ruby) which do not need a "require?"
Yar
2009-05-29 10:14:42