On Thu, 31 Oct 2002, Nat Pryce wrote:

> How would you import a literal definition?  If you define it in a file,
> can it only be used within a file?  Or can it be imported into another
> file (by the require statement for example)?

Pseudocode, assuming that only '<' ... '>' literals are user definable:

in vector.rb:

class Vector
  def initialize x,y,z
    @x, @y, z = x, y, z
  end
end

in sample.rb:

require 'vector'
literal Vector.new
<0,1,2>
# Is equivalent to Vector.new (0,1,2), but only in this file
# and only until it is (possibly) redefined

So custom literals would be per file aliases for <>(*args).

  -- Nikodemus