Just `base`
Posted: Tue Jan 21, 2014 3:54 am
As with many object-oriented languages, it's common enough in Cobra to invoke a base method (aka "super" in some languages). For example:
Invoking the same method name is extremely common and passing the same parameters is fairly common as well. I'm considering allowing two syntactic shortcuts. One is to allow the method name to be excluded:
And the other is to allow the arguments to be excluded, presuming you want to pass them as they were passed in with no changes:
`base` is already a keyword btw.
I can't think of any conflicts or problems that this would lead to? Can you? Any objections, comments, opinions?
Are there other languages that allow a shortened form of base/super invocation?
class A inherits B
def doSomething(name as String, count as int)
base.doSomething(name, count - 1)
# do more stuff
Invoking the same method name is extremely common and passing the same parameters is fairly common as well. I'm considering allowing two syntactic shortcuts. One is to allow the method name to be excluded:
class A inherits B
def doSomething(name as String, count as int)
base(name, count - 1)
# do more stuff
And the other is to allow the arguments to be excluded, presuming you want to pass them as they were passed in with no changes:
class A inherits B
def doSomething(name as String, count as int)
base
# do more stuff
`base` is already a keyword btw.
I can't think of any conflicts or problems that this would lead to? Can you? Any objections, comments, opinions?
Are there other languages that allow a shortened form of base/super invocation?