Modify existing types (no meta-programming)

47 views
Skip to first unread message

guest

unread,
Nov 8, 2010, 8:42:55 AM11/8/10
to gosu-lang
What is it about? Why not add links to related documentation section?

Carson Gross

unread,
Nov 8, 2010, 10:25:19 AM11/8/10
to gosu...@googlegroups.com
It is referring to enhancements, which can be used to add methods and properties to existing classes.  The methods really end up as static methods that are invoked with the object in question, and do not dispatch dynamically, but are useful to add application specific behavior to existing classes or to address shortcomings of existing classes.

Documentation is here:

This is how certain methods got onto core java classes, such as:

  var f = new File( "/tmp/foo.txt" )
  f.write( "That was easy" ) // <-- an enhancement method from CoreFileEnhancement.gsx

Good idea adding links.  We've been focused more on the release and less on the website lately, but we'll be improving it based on feedback.

As an aside, using enhancements to add methods to an existing type is colloquially referred to as "donkey patching" (vs. monkey patching in dynamic languages.)

Cheers,
Carson


On Mon, Nov 8, 2010 at 5:42 AM, guest <mlk...@gmail.com> wrote:
What is it about? Why not add links to related documentation section?

--
You received this message because you are subscribed to the Google Groups "gosu-lang" group.
To post to this group, send email to gosu...@googlegroups.com.
To unsubscribe from this group, send email to gosu-lang+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gosu-lang?hl=en.


Reply all
Reply to author
Forward
0 new messages