On Mon, 28 Jan 2002, Dave Thomas wrote:
> Mathieu Bouchard <matju / sympatico.ca> writes:

> But the String literal "fred" is still a special case inside the
> interpreter,

By my plan, instances of String would remain special, but would be ten
times less so.

> Without support from within, you're still never going to be able to
> integrate an externally written String, or Hash, or whatever into the
> main language.

Well, I know that. I have plans, but I don't know which one(s) to choose
yet, and whether I'll pursue any at all.

> But let's say we want to (and I'd like to). So then you have the issue
> of how that internal support is going to communicate the characters
> 'f', 'r', 'e', and 'd' to your String class's constructor, written in
> Ruby itself.

What makes you believe the String class's constructor would be written in
Ruby itself?

And what is most intriguing to me is: what do you think the Array class's
constructor would take as argument?

> Until that comes along (and it might come along with other Ruby
> interpreters being written)  we're not really closer to the idea of
> being able to write a practical String class in Ruby.

I haven't got it for String yet, but here is the equivalent for Array
runnable right now:

class Array
	alias :get :[]
	alias :get_seq :[]
	alias :put :[]=
	alias :put_seq :[]=

	# note: HollowArray#pack is left to be written.
	(instance_methods - %w(get get_seq put put_seq length pack)).
		each {|sel| remove_method sel }

	include HollowArray

	# cut recursion.
	def to_a; self end
	def to_ary; self end
end

Time: 3.060423
FAILURES!!!
Test Results:
 Run: 66/66(434 asserts) Failures: 1 Errors: 2

> and no amount of external code is going to change that.

________________________________________________________________
Mathieu Bouchard                   http://hostname.2y.net/~matju