You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Similar to the way that @ or this would alias to the class itself in a class declaration (to create static members), I've found, in certain situations, it might be beneficial to have super alias to the class' parent in the same way. Take a look at the following usage example:
# Lets pretend we have a long namespaced class...classReally.Long.Namespace.Fooarr: [1,2,3,4]
# Attempted to use 'super' as an alias for the parent class.# Fails to compile: "Cannot call super on an anonymous function."classBarextendsReally.Long.Namespace.Fooarr:super::arr.concat [5,6,7,8]
# Works fine when 'super' is replaced with the parent-proper.# Not very elegant though.classBazextendsReally.Long.Namespace.Fooarr:Really.Long.Namespace.Foo::arr.concat [5,6,7,8]
In the example, I desire to bring in values from the parent class' prototype of arr and concatenate them with additional values for use by the child class' version of arr. A very weird way of inheriting array values, I know, but I've found a use for it in a library I'm using, which is what brought it up.
This would really only be a minor visual enhancement and convenience. The times this might be useful are few and far between, but I figure I'd throw it out there as a possible enhancement.
The text was updated successfully, but these errors were encountered:
Similar to the way that
@
orthis
would alias to the class itself in a class declaration (to create static members), I've found, in certain situations, it might be beneficial to havesuper
alias to the class' parent in the same way. Take a look at the following usage example:In the example, I desire to bring in values from the parent class' prototype of
arr
and concatenate them with additional values for use by the child class' version ofarr
. A very weird way of inheriting array values, I know, but I've found a use for it in a library I'm using, which is what brought it up.This would really only be a minor visual enhancement and convenience. The times this might be useful are few and far between, but I figure I'd throw it out there as a possible enhancement.
The text was updated successfully, but these errors were encountered: