JamesWang wrote:
Does Curl support method or procedure override?

I can define two procedures with the same name in Curl.Does it mean Curl
does not support that?

I am not sure what you mean. Curl does not allow two things to use the same name within the same package or class (with only a few exceptions for class members: getters & setters, primary & secondary constructors, and factories). Curl does not support what C++/Java calls "overloading": defining multiple methods or functions with the same name but taking different arguments. Curl does support what is usually called "overriding", which is the ability to override a superclass's method implementation in a subclass, as in:

{define-class Parent
   {method  {foo}:void

{define-class Child {inherits Parent}
  {method {foo}:void

When the 'foo' method is invoked on Child instances, its own version will be used instead of that of Parent.

It is possible to mimic the behavior of overloading by defining a macro which examines its arguments and determines which implementation to dispatch to, but it is usually not worth the trouble.

- Christopher

Reply via email to