Yes, I think this is a good idea. Unfortunately, Cobra does not yet handle the combination of extensions and member overloads. For example, the following code fails to compile:
extend String
def split(chars as IList<of char>) as String[]
return String[](5) # TODO
class X
def main is shared
s = 'a,b:c:d,e,f'
trace s.split([c',', c':'])
However, it does get all the way to code generation so maybe this is a reasonably small bug. I have augmented
ticket:1 with some notes.
You can tell extensions were high on my mind since I entered them as the first Trac ticket.
Regarding augmenting Cobra.Lang, the files are now found in a subdir of Source called Cobra.Lang so that's:
<workspace>\Source\Cobra.Lang\*.cobra
You'll notice one of the files is called "Extensions.cobra". Also, if you were to add a file, you would add its filename to the "files.text" file in that same directory.
Then to rebuild the Cobra.Lang.dll in the Source directory, you say "cobra -bsl" or "cobra -bsl -v:2" if you want something more interesting to look at it.
Or you can say "install-from-workspace" if you're ready for that.
Finally, when creating library code, strongly consider using interfaces like IList<of> for argument types so that the method can be reused with more types of objects.