mwh/minigrace — pull request #26 by DanielGibbsNZ (2013-07-08 23:05:03+00:00)
Title: Overriding print

Currently the compiler turns any method call with the name "print" into a call to `gracelib_print`. This means that code that defines other methods called print, such as the following will not working properly.

class Cat.new(name') {
def name = name'
method print {
io.output.write("A cat named {name}.\n")
}
}

Cat.new("Gregory").print

The fix in 956a768 fixes this by only using `gracelib_print` if the object that the method is being called on is `prelude` which it is unless `print` has been overridden. Furthermore, to use print within an overridden print method, you don't need to use `io.output.write`, you can use `prelude.print`.