__color__ __group__ ticket summary component version milestone type owner status created _changetime _description _reporter 2 Active Tickets 378 CIE by incomplete `StreamType` construction. Cobra Compiler 0.9.6 defect new 2014-08-02T09:28:05Z 2014-08-02T09:57:33Z "Cobra svn:3116 throws this CIE {{{ error: COBRA INTERNAL ERROR / NullReferenceException / Object reference not set to an instance of an object. }}} when compiling this program: {{{ class Program shared def m as T* return T[](0) def main x = .m CobraCore.noOp(x) }}} " thriwkin 2 Active Tickets 379 enum of int8/uint8: translation wrong Cobra Compiler 0.9.6 defect new 2014-08-05T03:19:57Z 2014-08-07T11:20:24Z "If an `enum` is declared with an underlying type of `int8` or `uint8` then the translation to C# is incorrect: * `int8` is translated to `byte` instead of `sbyte`[[BR]] -- without any message! * `uint8` is translated to `ubyte` instead of `byte`,[[BR]] and the C# compiler gives this message: [[BR]] ""error: CS1008: Type byte, sbyte, short, ushort, int, uint, long, or ulong expected"". This program should compile and run: {{{ enum EnumOfInt8 of int8 A, B, C enum EnumOfUInt8 of uint8 A, B, C class Program def main is shared t = Enum.getUnderlyingType(EnumOfInt8.getType) print t assert t is int8 assert t is System.SByte t = Enum.getUnderlyingType(EnumOfUInt8.getType) print t assert t is uint8 assert t is System.Byte }}} That `of int8` is '''quietly''' translated incorrectly can cause a lot of trouble, especially in a large program. " thriwkin 2 Active Tickets 380 "CIE caused by local var declaration ""x as EnumType""." Cobra Compiler 0.9.6 defect new 2014-08-05T04:28:56Z 2014-08-05T04:52:05Z " Compiling this with Cobra svn:3116 {{{ class Program def main is shared x as PlatformID CobraCore.noOp(x) }}} causes this CIE: {{{ error: COBRA INTERNAL ERROR / ArgumentOutOfRangeException / Index was out of range. Must be non-negative and less than the size of the collection.; Parameter name: index }}} The critical code pattern is: {{{ def m x as T ... }}} where `T` references an enum which is defined in another assembly, for example `PlatformID, StringComparison, StringSplitOptions, ...` . " thriwkin 2 Active Tickets 164 Option to keep bytecode in memory Cobra Compiler 0.8.0 enhancement new 2009-07-03T07:59:03Z 2009-08-24T03:25:35Z "Often when treating Cobra in a script-like manner it's undesirable to create a binary file. A good option would be to have an option like -inmemory where the bytecode is kept in memory and executed from there. {{{ #!python #! /usr/bin/cobra -inmemory class Foo def main print 'I can run without creating an executable' }}}" webnov8 3 Active Tickets 243 Invariants called too many times and in wrong order Cobra Compiler 0.8.0 defect Chuck assigned 2010-08-09T22:53:39Z 2013-07-08T17:35:22Z " {{{ class A cue init base.init print 'inside init of A' def m1 as bool print 'inside invariant of A' return true invariant .m1 class B inherits A cue init base.init print 'inside init of B' def m2 as bool print 'inside invariant of B' return true invariant .m2 class P def main is shared B() }}} '''Actual result''' {{{ inside init of A (1) inside invariant of A (2) inside init of B inside invariant of A inside invariant of A (3) inside invariant of B }}} (1) At the end of the base class constructor the object is not yet constructed and it's invariant need not hold and shouldn't be called. (2) Additionally if the invariant is called at that point and includes calls to any methods overridden in the derived class they can fail because it hasn't constructed yet and its state is not ready to be used. (3) Extra test of A's invariant just not needed. I guess it's because I've used calls to methods to show when it's in the invariants, but again, the object is not finished constructing so it need not call the invariant on the exit of that method. (It's finished constructing after the invariant check at the end of the most derived init, not before, so at any time before that, method calls, or whatever used in the init, the invariant shouldn't be called yet.) '''Expected result''' {{{ inside init of A inside init of B inside invariant of A inside invariant of B }}} BTW: you can hit me up in chat to discuss, instead of us bouncing replies back and forth here. More productive, yeah? Cheers. nevdelap(at)gmail(dot)com for *both* gmail chat & MSN, or nevdelap in yahoo." nevdelap 3 Active Tickets 262 Cobra needs support 'implements' and overloads on properties Cobra Compiler 0.8.0 defect Chuck assigned 2010-10-24T08:28:39Z 2010-11-28T08:10:25Z "Currently cobra supports overloads and specifying 'implements' (for describing that a method provides an implementation of an interface method) on methods but it is not yet provided on properties. It needs to be because this lack of implementation makes providing a manual 'raw' implementation of an IEnumerator (for a generic) impossible(*)[[BR]] [[BR]] since that interface requires properties defining both .current as [[BR]] and .current as Object[[BR]] Heres a minimal impl for a simple generic range enumerator showing the issue. {{{ # very simple Generic Enumerable implementation class Ranger implements IEnumerable var _start as T var _stop as T cue init(start as T, endSent as T) base.init _start = start _stop = endSent def getEnumerator as IEnumerator return RangeEnumerator(_start, _stop) def getEnumerator as System.Collections.IEnumerator implements System.Collections.IEnumerable return .getEnumerator class RangeEnumerator implements IEnumerator var _first = false var _start as T var _stop as T var _currVal as T cue init(start as T, stopVal as T) base.init _start = start _stop = stopVal _first = true def hasMoreElements as bool return _currVal <> _stop def nextElement _currVal += 1 # # For IEnumerator # def dispose pass def reset _currVal = _start _first = true def moveNext as bool if not _first .nextElement _first = false if .hasMoreElements return true return false get current as T return _currVal #get current as Object # return _currVal # # return .current class Test def main is shared for i in Ranger(1,10) print i }}} As is it emits a diagnostic (as expected/desired) {{{ c:\home\hops\src\cobra\Tst\simpleGenericEnum.cobra(18): error: ""RangeEnumerator"" does not implement interface member ""System.Collections.IEnumerator.Current"". ""RangeEnumerator.Current"" is either static, not public, or has the wrong return type. (C#) warning: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll: (Location of symbol related to previous error) (C#) c:\home\hops\src\cobra\Tst\simpleEnum.cobra(56): warning: (Location of symbol related to previous error) (C#) Compilation failed - 1 error, 2 warnings }}} If the second 'get current as Object' is uncommented it still emits a diagnostic regarding duplicated property names {{{ simpleGenericEnum.cobra(59,6): error: There is already another class member with the name ""current"". Compilation failed - 1 error, 0 warnings }}} (*) A 'raw' implementation provides the interface itself rather than deferring it to a embedded class or using a generator. This defect only marked as major rather than critical or higher since most Enumerators can be provided as a generator (using yield). This is not immediately obvious if someone attempts an implementation in the above fashion... " hopscc 3 Active Tickets 271 Get compile error when using anonymous method with delegate(sig) Cobra Compiler 0.8.0 defect Chuck assigned 2011-01-15T22:03:11Z 2011-01-16T12:17:54Z "When I attempt to compile the code attached which uses a sig/delegate and an anonymous method, I get the following compile error: error: COBRA INTERNAL ERROR / ArgumentOutOfRangeException / Index was out of range. Must be non-negative and less than the size of the collection.; Parameter name: index Compilation failed - 1 error, 0 warnings Not running due to errors above." torial 3 Active Tickets 308 cobra internal error: unknown member exception Cobra Compiler 0.8.0 defect Charles assigned 2012-11-15T18:42:03Z 2012-11-25T01:56:55Z "version: {{{ The Cobra Programming Language svn:2844 (post 0.9) / 2012-11-14 on .NET CLR v4.0.30319 on Microsoft Windows NT 5.1.2600 Service Pack 3 at C:\Cobra\Cobra-svn-2844\bin\cobra.exe }}} the compilation error: {{{ Error: error: COBRA INTERNAL ERROR / UnknownMemberException / obj=MethodSig-sh(6749, name=LimitReachedHandler, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didStartBindImp=true, didBindImp=true, token=Token(SIG, 'sig', 'sig', ln 36, col 2, H:\projects\generic_project\ManageProfiling.cobra), didBindInh=true, isGeneric=false, isGenericDef=false, needsConstruction=false, genericDef=nil, baseClass=Class-mi(1031, name=MulticastDelegate, didStartBindInh=true, didBindInh=true, didStartBindInt=true, didBindInt=true, didBindImp=false, token=Token.empty, didBindInh=true, isGeneric=false, isGenericDef=false, needsConstruction=false, 1031), nativeType=nil, baseNode=LibraryTypeProxy-mi(6748, didBindInh=false, didBindInt=false, didBindImp=false), 6749), name='IsPublic', type=MethodSig (generic_project) }}} okay, the code that triggered it is perhaps kinda tricky. I have a mixin with a shared (static) event. (basically notifying when would be a good time to do a potentially heavy operation) and the adding part, registers a listen with a method, in the 'cue init' part, if the right option flag is set. the problem may come from the event signature, which is empty. here's some code: {{{ mixin ManageProfiling sig LimitReachedHandler event reachedLimit as LimitReachedHandler is shared class Controller adds ManageProfiling cue init(view as IView, options as Options) base.init _opts = options .attachView(view) if Options.Profile in _opts listen ManageProfiling.reachedLimit, ref .doSaveState def doSaveState pass }}} Thanks for all the work!" kobi7 3 Active Tickets 321 Overload resolution needs improvement Cobra Compiler 0.9.3 defect new 2013-05-14T00:09:30Z 2013-05-27T10:51:40Z "Cobra's method overload resolution skips certain method names with the following `if` guard in _bindImp of CallExpr: {{{ if winner.name not in ['format', 'invoke', 'split', 'sort'] }}} That indicates that 3rd party libraries are going to have problems which currently have no workaround (other than using a `sharp` string). Note that since Cobra uses C# as a back-end, it will largely need to match C#'s overload resolution with the exception that since extension methods can be called explicitly as static/shared methods, Cobra may bind to those in cases where C# would not. See also: ticket:189 " Charles 3 Active Tickets 342 Cannot declare method overloads in mixins Cobra Compiler 0.9.4 defect new 2013-07-18T21:42:02Z 2013-07-20T16:51:01Z "The following code produces the error message: 'mixin added method ""foo"" is already in class ""Testing""' {{{ mixin Behavior def foo(i as int) pass def foo pass class Testing adds Behavior pass }}} " nerdzero 3 Active Tickets 346 Cannot break out of a loop from within a branch Cobra Compiler 0.9.4 defect new 2013-10-03T17:56:44Z 2013-10-03T17:56:44Z "The generated C# treats the 'break' statement as being part of the switch structure instead of breaking out of the loop. Test case that results in infinite loop. {{{ class Program def main x = 1 while true branch x on 1 trace x break else print ""Should not get printed"" print ""done"" }}} One solution is to generate a goto statement in the C#. Some more alternatives are here: http://stackoverflow.com/questions/1987379/break-out-of-a-loop-that-contains-a-switch-statement-c" nerdzero 3 Active Tickets 356 Preconditions for methods that return a stream are not checked Cobra Compiler 0.9.6 defect new 2014-01-21T23:49:00Z 2014-01-21T23:49:00Z "This program fails, but should succeed. The contract for .bar is never checked/executed at run-time: {{{ #!cobra class P var _last = '' def main .foo assert _last == 'foo' .bar for b in .bar, print b assert _last == 'bar' def foo as int require .required('foo') body return 0 def bar as int* require .required('bar') body yield 1 def required(name as String) as bool _last = name return true }}} " Charles 3 Active Tickets 361 Getters should always specify return types Cobra Compiler 0.9.6 defect new 2014-02-01T06:20:41Z 2014-02-04T10:46:36Z "currently cobra accepts code such as this: {{{ get hasSubCmds return _sub.count > 0 }}} however it seems to get confused about the type, in the call site. I suggest making it mandatory to supply a return value, (which the user may simply forget sometimes). {{{ get hasSubCmds as bool return _sub.count > 0 }}} " kobi7 3 Active Tickets 373 block comments extends to last commented line Cobra Compiler 0.9.6 defect new 2014-07-14T10:11:18Z 2014-07-14T10:11:18Z "The entire line following the closing tag for a block comment #/ is deactivated as well. Compilation of... {{{ class DebugCase def main is shared /# i as int for i in -13:57:7 print i i as int #/ i=-13 while i<57 print i i += 7 }}} ...fails with {{{ # cobra.bat -version Cobra svn:3116 (post 0.9.6) / 2014-07-10 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1 # -c CobraDebug01.cobra CobraDebug01.cobra(10): error: Cannot find ""i"". There are members with similar names including "".cue.init"", "".finalize"", "".main"", "".memberwiseClone"" and "".toString"". CobraDebug01.cobra(11): error: For ""print"" arg 1: Cannot find ""i"". There are members with similar names including "".cue.init"", "".finalize"", "".main"", "".memberwiseClone"" and "".toString"". CobraDebug01.cobra(12): error: Cannot find ""i"". There are members with similar names including "".cue.init"", "".finalize"", "".main"", "".memberwiseClone"" and "".toString"". }}} You can create all sorts of compiler- or runtime errors this way. For instance the following... {{{ class DebugCase def main is shared i = -27 /# i as int for i in -13:57:7 print i i as int #/ i=-13 while i<57 print i i += 7 }}} ... produces the output {{{ -27 -20 -13 -6 1 8 15 22 29 36 43 50 }}} It is possible to work around this by putting the closing tag at the end of the last line to comment OR insert a line break after it." ptokremin 3 Active Tickets 374 shared classes do not compile Cobra Compiler 0.9.6 defect new 2014-07-15T11:47:53Z 2014-07-17T09:36:59Z "It is not possible to declare shared (static) classes. The following definition... {{{ namespace CobraDebug03 class LibTools is public, shared def doIt as String is public, shared return ""great, it work's! :-)"" }}} ... produces error messages from the c# compiler (since they are in german on my system I translated them): {{{ # cobra.bat -version Cobra svn:3116 (post 0.9.6) / 2014-07-10 on .NET CLR v4.0.30319 on Microsoft Windows NT 6.1.7601 Service Pack 1 #cobra.bat -c CobraDebug03.cobra d:\tmp\nh\CobraDebug03.cobra(5): error: ""CobraDebug03.LibTools._ih_invariantGuard"": instance members may not be declared in a static class d:\tmp\nh\CobraDebug03.cobra(5): error: static classes may not have an instance constructor Compilation failed - 2 errors, 0 warnings }}} The messages refer to the property _ih_invariantGuard and the constructor for the c#-class. Here's the intermediate code (without the #line tags) generated by cobra: {{{ using CobraCoreInternal = Cobra.Core; namespace CobraDebug03 { public static class LibTools : global::System.Object { int _ih_invariantGuard; [CobraCoreInternal.NotNull] public static global::System.String DoIt() { return ""greaaaat :-)""; } public LibTools() : base() { } } // class LibTools } // namespace CobraDebug03 }}} A rather ugly work-around is NOT to declare the class as shared. " ptokremin 3 Active Tickets 69 Consume operator overloads Cobra Compiler 0.8.0 enhancement new 2008-11-10T23:28:50Z 2008-12-03T09:40:13Z Consume operator overloads found in library classes such as !DateTime. Chuck 3 Active Tickets 70 Declare operator overloads. Cobra Compiler 0.8.0 enhancement new 2008-11-10T23:41:36Z 2009-01-04T20:25:18Z "Declare operator overloads for your own classes. Probably makes sense to do ticket:69 (consume operator overloads) first. Also, I haven't designed a syntax for this. And it probably makes sense to review operator overloading in various languages such as C#, Python and C++. I think Java is still lacking in this area. " Chuck 3 Active Tickets 90 implicit conversions Cobra Compiler 0.8.0 enhancement new 2008-12-09T18:35:00Z 2008-12-12T15:25:13Z "Support user-defined implicit conversions like C# does. See: * http://msdn.microsoft.com/en-us/library/z5z9kes2.aspx * http://www.google.com/search?hl=en&safe=off&q=C%23+implicit+conversions This may be done best through a `cue` -- I don't know yet. " Chuck 3 Active Tickets 150 Implement extend IList.toDictionary(...) Cobra Compiler 0.8.0 enhancement new 2009-02-14T15:33:03Z 2009-02-16T10:44:43Z "Suppose you have a list of customers. You may wish to convert the list to a dictionary keyed by customer name (or customer code). Likewise with an enumerable. Would be nice to do it via one expression as enable by an extension method: {{{ #!python byName = customers.toDictionary(do(c as Customer)=c.name)) # perhaps with inference it could be shortened to: byName = customers.toDictionary(do(c as Customer)=c.name)) # for now you can do this byName = Dictionary() for c in customers, byName[c.name] = c }}} There are various issues to work out to accomplish this as expressed in the TODO's below. This ticket is possibly more interesting for those issues than for the actual extension method. {{{ #!python # x-to-dictionary.cobra # in Workspace-new sig Transform(input) as dynamic namespace Cobra.Lang extend IList /# # TODO: support generic delegate declaration sig KeyFor(value as TIn) as TOut def toDictionary(keyFor as KeyFor) as Dictionary d = Dictionary() for item in this key = keyFor(item) d[key] = item return d #/ /# # TODO: No Func before .NET 3.5. Would be nice if Cobra std lib filled it in def toDictionary(keyFor as Func) as Dictionary d = Dictionary() for item in this key = keyFor(item) d[key] = item return d #/ # TODO: can't do generic methods in generic extensions yet def toDictionary(keyFor as Transform) as Dictionary ensure result.count == .count body d = Dictionary() for item in this key = keyFor(item) d[key] = item return d class TestCustomer def init(name as String, balance as decimal) _name, _balance = name, balance get name from var as String get balance from var as decimal class Test test customers = [ TestCustomer('Acme, Inc.', 15_400.00), TestCustomer('Systems LLC', 6_800.00), ] d = customers.toDictionary(do(c as Customer)) return c.name assert d.count == 2 assert d['Acme, Inc.'].balance == 15_400.00 assert d['Systems LLC'].balance == 6_800.00 print 'done testing.' def main is shared print 'done main.' }}} The file in question where this would land is \Source\Cobra.Lang\!ExtendList.cobra and !ExtendEnumerable.cobra. " Chuck 3 Active Tickets 174 Support for Regular Expression literals and matching Cobra Compiler enhancement Chuck assigned 2009-07-23T13:02:46Z 2011-01-04T08:18:32Z "Given the importance of regular expressions in everyday programming a literal for Regex types would be a great convenience. {{{ #!python if /^\bcobra\b/i in 'cobra programming' print 'found cobra' }}} {{{ #!python for /\b(\w+)\b/ in 'the quick brown fox' print $1 # support for groups/captures, maybe? }}} {{{ #!python exp = /\bcobra\b/c # compile this regex }}}" webnov8 3 Active Tickets 309 tests in mixins Cobra Compiler 0.8.0 enhancement new 2012-11-18T08:39:20Z 2013-04-18T18:16:57Z "can we have tests in mixins? initializing the mixin, like a normal class, and then asserting. I currently refer to tests in the mixin's body, not the method's body. for example: {{{ mixin ABC var h = 3 test p = ABC() assert p.h == 3 }}} " kobi7 3 Active Tickets 310 enum check on compilation Cobra Compiler 0.8.0 enhancement new 2012-11-28T16:44:17Z 2013-03-21T21:42:51Z "I would like to suggest a feature request: when branching on an enum, I would like to get a warning if I omit in the 'on' cases one of the enum fields. one warning for each field. even if I have an 'else' case. This is very useful when adding another field, it will let me know all the places in code that I should update. ((the current alternative is throwing a notsupported or notimplemented exception on the else case, which is then more easily discovered. or assert false in that position. however this is on runtime.))" kobi7 3 Active Tickets 331 Bind to C# extension methods Cobra Compiler 0.9.4 enhancement hopscc assigned 2013-05-29T23:12:13Z 2014-01-26T21:49:23Z "Cobra has its own extension methods feature supported back in .NET 2.0. C# added these for .NET 3.0 (or 3.5, I forget) and uses a different declaration technique. Cobra should be enhanced to bind method calls to C# extension methods. There are numerous .NET libraries that use these. I don't think any of the other tickets about extension methods cover this. Here is a test case: {{{ #!cobra @ref 'System.Core' use System.Linq class P def main list = [1, 2, 3, 4, 5, 6] assert list.elementAt(3) == 4 assert list.select(do(x) = x * 2) == [2, 4, 6, 8, 10, 12] assert list.sum == 21 }}} " Charles 3 Active Tickets 381 Is this Language Dead? Cobra Compiler 0.8.0 idea Charles assigned 2015-08-13T05:34:53Z 2015-08-16T18:15:16Z Well I would like to know if you are still developing on this to make it production ready and release a version 1.0? pyros2097 3 Active Tickets 18 CodeDom Support Cobra IDE: Miscellaneous 0.8.0 task new 2008-05-08T09:56:32Z 2009-06-20T02:56:57Z "Implement CodeDom support. " Chuck 3 Active Tickets 19 Create a .msi installer Cobra Compiler 0.8.0 task new 2008-05-11T21:43:22Z 2009-08-19T03:58:19Z "Create an .msi installer for binary distribution of the Cobra open source compiler. See Cobra's own !ReadMe.text for hints on how people are ""installing"" it currently. " Chuck 3 Active Tickets 130 "The compiler doesn't find the ""closest"" extension method" Cobra Compiler 0.8.0 Cobra 0.9 defect jonathandavid accepted 2009-01-08T02:10:02Z 2009-03-08T05:48:16Z "Test case: {{{ # x-extend.cobra class A pass class B inherits A pass class C inherits B pass extend B def n as int return 2 extend C def n as int return 3 class P def main is shared b = B() assert b.n == 2 c = C() assert c.n == 3 }}} Cobra takes the first extension method it can find instead of the closest among all available. Also, this bug is blocking further extensions being added to Cobra.Lang\ExtendIEnumerable.cobra " Chuck 3 Active Tickets 152 "Automatic library referencing from ""use"" does not always work" Cobra Compiler 0.8.0 Cobra 0.9 defect Chuck assigned 2009-02-24T05:32:52Z 2013-05-05T03:01:04Z "The following program gives an error if you comment out the ""args"" directive: {{{ #!python use System.Windows.Forms use System.Drawing %% args -ref:System.Drawing class Program def main is shared print Color.red }}} * error: The type or namespace name ""Color"" does not exist in the namespace ""System.Drawing"" (are you missing an assembly reference?) I believe the problem is that * ""use System.Windows.Forms"" automatically refs System.Drawing * then ""use System.Drawing"" doesn't fault the System.Drawing.dll reference in * so Cobra fails to pass an /r: onto C#. See also: [http://cobra-language.com/forums/viewtopic.php?f=4&t=304#p1808 discussion] " Chuck 3 Active Tickets 153 Regression test problems re tests with CultureInfo assumptions Cobra Compiler 0.8.0 Cobra 0.9 defect jonathandavid assigned 2009-02-24T05:47:55Z 2013-05-06T01:11:26Z "Reported by jonathandavid: About the failing tests: So far I've been able to fix the following ones: (29) 062-string-substitution.cobra (85) 120-primitive-type-members.cobra (101) 310-primitive-members.cobra (133) 510-number-parse.cobra (267) 100-number-float32.cobra (269) 100-number-float64.cobra (273) 106-number-decimal.cobra I've fixed all of them by adding CultureInfo?.invariantCulture when calling toString or parse. Otherwise, my locale turned ""3.2"" into ""3,2"", which wasn't expected by the tests. I encountered my first problem with test ""(130) 504-sharp-error.cobra"". This test assumes that the C# will produce error messages in English, which is not the case in my installation. A similar thing happens with ""(445) 500-cannot-infer.cobra"", and with ""520-debug.cobra"". I think we can relax these tests a little bit so that they don't look for specific messages, but rather for things that won't change on a non-English locale. For example, instead of looking for a warning that contains ""related to"", we can look for a warning that contains simply the line that causes the warning ""(3)"". If you want I can perform these modifications, and once all tests pass in my installation, create a patch and submit it here. A different kind of problems occurs with ""(639) 410-use-lowernames-dll.cobra"". This took me a while to figure out. Apparently, the test is referencing a lowernames.dll file that should be in the current path. Instead, there is a lowernames.cs file. I got the test to pass by manually compiling this .cs file, which generates the necessary dll, but this is not done automatically when I install from source and run -testify. I don't know how to solve this problem, can you help me? Also, there seems to be a minor issue with the testify script itself. When a test fails, the test count is incremented twice, and the test name is written twice. For example: ... (taken from ticket:146) " Chuck 3 Active Tickets 370 Some MD/XS projects trigger a COBRA INTERNAL ERROR/FormatException Cobra Compiler 0.9.6 Cobra 0.9 defect new 2014-06-11T18:46:45Z 2014-06-30T14:59:00Z "On Mac OSX 10.8.5 , with Cobra 0.9.6, using Mono 3.4.0 I get the following Internal Error /Library/Frameworks/Mono.framework/External/xbuild/Cobra/Cobra.targets: error : error: COBRA INTERNAL ERROR / FormatException / Input string was not in the correct format Task ""CobraCompiler"" execution -- FAILED Done building target ""CoreCompile"" in project ""/Users/klickle/Downloads/CherryCobbler/CherryCobbler/CherryCobbler.cobraproj"".-- FAILED I have recently added a file (in progress of making a port of some python code), and the behavior did not manifest until I started on this file." torial 3 Active Tickets 1 Extension methods and properties Cobra Compiler Cobra 0.9 enhancement Chuck accepted 2008-03-10T06:50:19Z 2009-01-04T20:27:01Z "Support extension methods and properties on existing classes, interfaces and structs whether they come from DLLs or declarations. This feature is found in Smalltalk, Objective-C (categories), C#, VB and others. C# and VB do it on .NET 3.5, but Cobra is still targeting 2.0 and will support it there. The syntax will be: extend Foo def bar pass get baz as int return 1 One interesting question is whether or not to allow a nil receiver. C# does which, imo, is quite strange. For ""obj.Foo()"" in C# you need to know if Foo() is declared in obj's type or outside of it to know whether or not you can pass nil. " Chuck.Esterbrook 3 Active Tickets 55 Support command line format: cobra Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-10-28T04:30:55Z 2008-12-21T00:06:27Z "One of Cobra's goals is to provide scripting conveniences, and every scripting language in the world supports this: {{{ python foo.py args perl foo.pl args ruby foo.rb args }}} Cobra will too. The format is: {{{ cobra }}} " Chuck 3 Active Tickets 92 cue init Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-12T03:55:28Z 2009-04-26T04:00:19Z " * The first statement in the .init cue must be `base.init` or `.init` * If the signature is the same as an inherited one then `is override` or a `base.init` call is required, just like methods. * `init` can be overloaded just like a method. * `init` cannot be invoked outside of an `init` cue (other than indirectly through instantiation) * If no `init` cues are defined in a class then the `init` cues of the base class are inherited. * At some point `def init` should give a warning. * At some point the internal hacks around methods called `init` can be removed. See also: http://cobra-language.com/forums/viewtopic.php?f=4&t=213 " Chuck 3 Active Tickets 93 cue finalize Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-12T04:01:12Z 2008-12-12T04:01:12Z " * Not externally visible. * Review finalization in C#, VB and Java in order to fully spec this one out. " Chuck 3 Active Tickets 94 cue hash Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-12T04:08:17Z 2012-10-28T19:52:25Z "{{{ class X cue hash as int return ... }}} * One of the few cues that is externally visible. * Implements !GetHashCode() on .NET and hashCode() on JVM. * Requires `is override` or `base.hash` call. * `def hash as int` and `def hash` should give warnings about cues. " Chuck 3 Active Tickets 95 cue compare Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-12T04:13:14Z 2008-12-12T04:17:15Z "{{{ cue compare(other) as int cue compare(other as X) as int }}} * Note that there is already a .compareTo method that Cobra will look for. That likely will need to be retired. * `is override` or `base.compare` are required if the base class also provides this cue * The normal means of invoking this is with a comparison operator. * But still externally visible in case you need the value (-, 0, +) of the result. * Need to consider if implementing this can serve as an implementation of `cue equals` when `cue equals` is not present. * Some research and consideration is required about whether the argument to this method is typed or not, or if both cues could be declared/overloaded. Consider various generic and non-generic interfaces of .NET and JVM like IComparable. For example, one possible approach: {{{ class X cue compare(other as X) as int ... # Causes the dynamic cue compare to be implemented if not already as if you specified: cue compare(other) as int if other is this, return 0 if other inherits X return .compare(other) # will invoked the statically typed overload else throw }}} " Chuck 3 Active Tickets 96 cue equals Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-12T04:19:05Z 2008-12-12T04:19:05Z "{{{ cue equals(other) as bool cue equals(other as X) as bool }}} * Some of the issues around this cue are the same as cue `compare` * Not externally visible. Use == or <> " Chuck 3 Active Tickets 97 cue enumerate Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-12T04:20:40Z 2008-12-12T04:20:40Z "{{{ cue enumerate as T* }}} * Do not accept IEnumerable (or any other return type) " Chuck 3 Active Tickets 107 Syntactic relaxation: Type declaration clauses Cobra Compiler 0.8.0 Cobra 0.9 enhancement Chuck accepted 2008-12-21T00:27:43Z 2009-02-24T06:25:05Z "Outlined in http://cobra-language.com/forums/viewtopic.php?f=4&t=225 " Chuck 3 Active Tickets 113 Scope out the rest of anonymous methods / closures Cobra Compiler 0.8.0 Cobra 0.9 enhancement Chuck new 2008-12-21T00:55:26Z 2010-12-01T03:18:17Z "Determine what else is left for anonymous closures and make the appropriate tickets. Sources of information include: * discussion forms * Cobra test suite * Cobra source code comments (!AnonymousMethod, Parser) * C# docs on anonymous methods Off the top of my head, possible tasks include: * Type inference of arguments * Generic anonymous methods * Multiple anonymous methods But I don't know if that list is complete. " Chuck 4 Active Tickets 171 Dynamic does not work well with arithmetic Cobra Compiler 0.8.0 defect new 2009-07-19T19:09:17Z 2009-07-19T19:09:17Z "Dynamic works well with method calls. For example, given a local `d` of type `dynamic`, you can say `.foo(d)` even if .foo is expecting a static type. And you can say `x = d.bar(args)` where .bar is late bound. However, `x + d` and `d + x` yield compilation errors. They should work and be late bound. Same with all other operators. (Unfortunately, .NET does not make this easy as operators are static methods sitting around in various classes.) " Chuck 4 Active Tickets 187 Short circuit evaluation for chained comparisons Cobra Compiler 0.8.0 defect new 2009-11-03T06:26:37Z 2009-11-03T06:33:13Z "Like other boolean expressions, chained comparisons should short circuit. That means that subsequent expressions are not even evaluated if not needed. There is a test case commented out in Tests/320-misc-two/260-chained-comparison.cobra The original work was on ticket:161 and changeset:2229 " Chuck 4 Active Tickets 188 Chained comparisons should be implemented with strong types when possible Cobra Compiler 0.8.0 defect new 2009-11-03T06:31:50Z 2009-11-03T06:31:50Z "The implementation of chained comparisons uses the `dynamic` type even when an expression such as `0 <= i < 9` where `i` is type `int` could run at ""full native speed"" using all ints. For example, it should be possible to show that the above expression is substantially slower than ""0 <= i and i < 9"". See also: ticket:187 " Chuck 4 Active Tickets 214 Members use in preconditions on x mustn't be less visible than x. Cobra Compiler 0.8.0 defect new 2010-07-12T01:49:24Z 2012-10-31T21:20:29Z "My lame example covers just one case. __lame is less visible than meth, and so should fail to compile. {{{class A var __lame as int is private cue init base.init __lame = #[something secretly computed inside A] def meth require __lame == 1 body print ""hello"" class P def main a = A() a.meth}}}" nevdelap 4 Active Tickets 228 Cobra Internal Error with IronPython (mscorlib) Cobra Compiler 0.8.0 defect new 2010-07-31T04:35:53Z 2010-07-31T04:35:53Z "With IronPython 2.7, and the @ref'd DLLs copied from IronPython/Silverlight/bin into my bin directory, I get the following error: me@LAPBOT ~/code/sherlock/bin (master) $ cat test.cobra @ref ""IronPython.dll"" @ref ""Microsoft.Dynamic.dll"" @ref ""Microsoft.Scripting.dll"" @ref ""IronPython.Modules.dll"" use IronPython class Poo def main pass me@LAPBOT ~/code/sherlock/bin (master) $ cobra test.cobra error: COBRA INTERNAL ERROR / TypeLoadException / Could not load type 'System.Co llections.IStructuralEquatable' from assembly 'mscorlib, Version=2.0.0.0, Cultur e=neutral, PublicKeyToken=b77a5c561934e089'. Compilation failed - 1 error, 0 warnings Not running due to errors above. If I downgrade to IronPython 2.6.1, instead I get: error: COBRA INTERNAL ERROR / BadImageFormatException / Could not load file or a ssembly 'file:///c:\Users\me\code\sherlock\bin\IronPython.dll' or one of its dep endencies. This assembly is built by a runtime newer than the currently loaded r untime and cannot be loaded. I'm using Cobra from SVN." Kurper 4 Active Tickets 233 Weird COBRA INTERNAL ERROR printing event args (Gtk) Cobra Compiler 0.8.0 defect nevdelap assigned 2010-08-03T00:11:47Z 2010-09-03T19:11:35Z " {{{ @args -pkg:gtk-sharp-2.0 use Gtk class P def main is shared pass def onKeyPressEvent(o, args as KeyPressEventArgs) print args.event.key # error caused by this }}} error: COBRA INTERNAL ERROR / ArgumentException / An element with the same key already exists in the dictionary." nevdelap 4 Active Tickets 239 -out: does not affect -test Cobra Compiler 0.8.0 defect Chuck assigned 2010-08-08T17:42:00Z 2014-02-28T11:33:28Z "Steps to reproduce: 1. Create directory, add this file to it: {{{ # Specific DLLs shouldn't matter, just use something defined in em @ref ""bin/Lidgren.Network.dll"" use Lidgren.Network class Program def main test pass body # Do something that needs the DLL. NetPeerConfiguration(""MyExampleName"") }}} 2. Create bin/ directory in it, copy Lidgren.Network.dll into it (should work with any DLL, with test case changed appropriately) 3. ""cobra test.cobra -out:bin/"" works as expected 4. ""cobra test.cobra -out:bin/ -test"" fails with {{{ Unhandled Exception: System.IO.FileNotFoundException: Could not load file or ass embly 'Lidgren.Network, Version=2010.7.15.0, Culture=neutral, PublicKeyToken=nul l' or one of its dependencies. The system cannot find the file specified. File name: 'Lidgren.Network, Version=2010.7.15.0, Culture=neutral, PublicKeyToke n=null' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boo lean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, E vidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Bool ean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Cobra.Lang.Test.TestRunner._collectTestsFor(Assembly ass, Boolean willFoll owReferences, Set`1 found) at Cobra.Lang.Test.TestRunner.CollectTestsFor(Assembly ass, Boolean willFollo wReferences) at Cobra.Lang.Test.TestRunner.RunTestsFor(Assembly ass, Boolean willFollowRef erences) at Cobra.Lang.Test.TestRunner.RunAllTests() at Cobra.Lang.CobraCore.RunAllTests() at _GeneratedTestRunner.Main() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\M icrosoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure lo gging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fus ion!EnableLog]. }}}" Kurper 4 Active Tickets 247 init for base class called before preconditions on derived class init are tested & compile not protecting it's calls to toString Cobra Compiler 0.8.0 defect nevdelap assigned 2010-08-14T04:23:16Z 2013-04-01T08:06:05Z "This shows that that's the case. {{{ class A cue init base.init throw Exception() # Something fails class B inherits A var _s as String cue init(s as String) require s <> 'a' # This should have failed first. body base.init _s = s def toString as String is override return _s class P def main is shared print B('a') }}} '''Expected result:''' Unhandled Exception: Cobra.Lang.RequireException: blaa '''Actual result:''' Unhandled Exception: System.Exception: Exception of type 'System.Exception' was thrown. '''This shows up this further problem.''' {{{ class A cue init base.init # The difference is it's now throwing here. class B inherits A var _s as String cue init(s as String) require s <> 'a' body base.init _s = s def toString as String is override return _s class P def main is shared print B('a') }}} '''Expected result:''' Same as above. '''Actual result:''' It should never have started constructing, but since it has the compiler stringifies the object to print diagnostics, and since the object hasn't finished constructing and isn't ready to have it's methods called, we get this... {{{ Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at Cobra.Lang.CobraImp.ToTechString (System.Object x) [0x00000] at Cobra.Lang.CobraCore.ToTechString (System.Object x) [0x00000] at Cobra.Lang.SourceSite.ToString () [0x00000] at Cobra.Lang.StringMaker.ObjectToString (System.Object obj) [0x00000] at Cobra.Lang.StringMaker._makeString (System.Object x) [0x00000] at Cobra.Lang.StringMaker.MakeString (System.Object x) [0x00000] at (wrapper synchronized) Cobra.Lang.StringMaker:MakeString (object) at Cobra.Lang.AssertException.get_Message () [0x00000] at System.Exception.ToString () [0x00000] }}} So the second problem is that when the compiler is putting out diagnostics it should have a catch around stringifying objects so that if the toString throws it can keep going and produce meaningful output, and maybe replace the name with something, I don't know what. In this cause if it replaced it with 'BOOM!' (just for sake of this example) it would produce this, instead of the above. {{{ Unhandled Exception: Cobra.Lang.RequireException: sourceSite = /home/nev/Temp/cobra/test.cobra:12 in B.cue.init for object BOOM! info = nil this = BOOM! (s <> 'a') = false s = 'a' at B..ctor (System.String s) [0x00000] at P.Main () [0x00000] }}} " nevdelap 4 Active Tickets 283 Parser error regarding multi-line collection literals Cobra Compiler 0.8.0 defect Chuck assigned 2012-07-01T22:09:01Z 2013-05-12T15:06:30Z "The following program produces a false error from the parser: {{{ #!cobra class A var t = [ 0, 1, 3 ] var obj as Object def main pass }}} x-parser-problem.cobra(7,1): error: Expecting use, assembly, namespace, class, interface or enum, but got ""var"". It doesn't matter if the literal is a list or array. Until there is a fix, the workaround is to put the closing bracket (`]`) on the same level as the starting `var`. " Charles 4 Active Tickets 291 lambda and object initialization compiler error Cobra Compiler 0.8.0 defect new 2012-08-05T16:32:22Z 2012-08-17T16:23:29Z "This example comes from DefaultDictionary.cobra This compiles {{{ factory as Func = do = 5 dd = DefaultDictionary(factory, willRecordDefaults = false) }}} This doesn't {{{ dd = DefaultDictionary(do = 5, willRecordDefaults = false) }}} {{{ DefaultDictionary.cobra(112): error: Cannot convert ""anonymous method"" to non-delegate type ""object"" DefaultDictionary.cobra(112): error: The best overloaded method match for ""Cobra.CoreX.TestDefaultDictionary._ch_ext_init_6222(object, bool)"" has some invalid arguments DefaultDictionary.cobra(112): error: Argument ""#1"" cannot convert ""anonymous method"" expression to type ""object"" DefaultDictionary.cobra(58): error: The best overloaded method match for ""Cobra.CoreX.DefaultDictionary.DefaultDictionary(System.Func)"" has some invalid arguments }}} Cobra svn:2771 (post 0.8) / 2012-08-05 on Mono 2.10.9 CLR v4.0.30319 on Mac OS X 10.6.8 " jaegs 4 Active Tickets 348 Installer leaves root owned files Cobra Compiler 0.9.4 defect new 2013-12-22T21:06:33Z 2013-12-22T21:06:33Z "The installer requires sudo on UnixLike system and one side effect of this is the remainder of files that cannot be manipulated when not root: {{{ Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin/Debug/HelloWorld.exe: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin/Debug/HelloWorld.exe.mdb: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin/Debug: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/bin: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug/HelloWorld.cobraproj.FilesWrittenAbsolute.txt: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug/HelloWorld.exe: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug/HelloWorld.exe.mdb: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86/Debug: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj/x86: Operation not permitted Source/Cobra.MSBuild/TestProjects/ExampleSolution/HelloWorld/obj: Operation not permitted Source/hello.cobra: Operation not permitted Source/InstallFromWorkspace.exe.mdb: Operation not permitted Source/Misc/hello.exe.mdb: Operation not permitted }}} To fix this, possibilities include: * Modify the owner or perms afterwards * Run the commands that create these files in such a way that this doesn't happen in the first place Btw, the current workaround is to issue this command from within the workspace {{{ sudo chown -R MYUSERNAME . }}}" Charles 4 Active Tickets 357 Internal error for parameter named `result` Cobra Compiler 0.9.6 defect new 2014-01-27T02:29:20Z 2014-01-27T02:29:20Z "The following code gives an internal error: {{{ #!cobra class A def foo(result as int) as String return '' }}} The error goes away if `result` is named to something else, or if the return type and return statement are removed (add `pass`). Whether the method is `shared` or not makes no difference." Charles 4 Active Tickets 364 Cobra snapshot may have been compiled on .NET 4.5 and inadvertently introduced a dependency Cobra Compiler 0.9.6 defect new 2014-02-11T20:02:44Z 2014-02-14T17:12:55Z "I was installing Cobra on a new box for testing some older patches. The OS is Ubuntu 12.04 LTS. I installed the prerequisites: {{{ sudo apt-get install mono-runtime mono-dmcs mono-xbuild }}} This installed Mono 2.10.8.1 I downloaded the latest source from subversion: {{{ svn co http://cobra-language.com/svn/cobra/trunk/ cobra }}} I executed the installer: {{{ cd cobra/Source sudo bin/install-from-workspace }}} I got this exception: {{{ Compiling installation program... Missing method System.Environment::get_CurrentManagedThreadId() in assembly /usr/lib/mono/4.0/mscorlib.dll, referenced in assembly /home/ramon/cobra/Source/Snapshot/cobra.exe Unhandled Exception: System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'. at Cobra.Core_ert_b2a27b97480f2efb38f55a0042ba2a48.Extend_IEnumerable__T__ExtendIEnumerable.Numbered[FileSpec] (IEnumerable`1 _lh_this) [0x00000] in :0 at Compiler._compile1 (.CompileParams params) [0x00000] in :0 at Compiler.Compile (.CompileParams params) [0x00000] in :0 at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] in :0 at CommandLine.DoRun (System.Collections.Generic.List`1 paths) [0x00000] in :0 at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] in :0 at CommandLine.Run () [0x00000] in :0 at CobraMain.Main () [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Environment.get_CurrentManagedThreadId'. at Cobra.Core_ert_b2a27b97480f2efb38f55a0042ba2a48.Extend_IEnumerable__T__ExtendIEnumerable.Numbered[FileSpec] (IEnumerable`1 _lh_this) [0x00000] in :0 at Compiler._compile1 (.CompileParams params) [0x00000] in :0 at Compiler.Compile (.CompileParams params) [0x00000] in :0 at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] in :0 at CommandLine.DoRun (System.Collections.Generic.List`1 paths) [0x00000] in :0 at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] in :0 at CommandLine.Run () [0x00000] in :0 at CobraMain.Main () [0x00000] in :0 }}} I googled the exception and got this hit: http://marcgravell.blogspot.de/2012/09/iterator-blocks-missing-methods-and-net.html I haven't had the chance to test on .NET 4.0. Need to find a system that doesn't have 4.5" nerdzero 4 Active Tickets 368 Dynamic variables that are Arrays should support Indexing Cobra Compiler 0.9.6 defect new 2014-04-24T11:50:50Z 2014-04-24T11:54:35Z "If variables or fields are declared as dynamic and typed as Arrays they should support Indexors (read only at least) given how many of the .Net framework APIS return arrays rather than lists/collections. Currently indexing such a variable emits a 'Cobra.Core.UnknownMemberException' from the RTL call to Cobra.Core.CobraImp.getIndexerValue since it only looks for Object/Collection Indexors and not ones on arrays. See [http://cobra-language.com/forums/viewtopic.php?f=4&t=17287 UnknownMemberException thrown on local variable assignment] for a very good example " hopscc 4 Active Tickets 369 Assigning values to enums out-of-order does not work Cobra Compiler 0.9.6 defect new 2014-05-02T12:04:46Z 2014-05-05T11:32:52Z "This may be an abuse of enums, but I am setting up some default values in my app through the use of enums, and I noticed that assigning them values directly does not work if they are not in numerical order. I do not receive a warning or error during compilation. e.g., class Test ..enum Defaults ....HalfAMillion = 500000, ....Zero = 0 ..def main ....print Defaults.Zero to int #actually prints 500001 " NoshBar 4 Active Tickets 376 Cannot use stream as paramter type if type name is fully qualified Cobra Compiler 0.9.6 defect new 2014-07-28T16:12:45Z 2014-07-28T16:12:45Z "This code: {{{ def foo(tokens as Cobra.Compiler.IToken*) pass }}} produces this error message: {{{ Cannot find ""IToken*"" at component 3 of qualified type }}} Workarounds include adding a using directive and not using the fully qualified name or creating a type alias such as: {{{ use ICobraToken = Cobra.Compiler.IToken def foo(tokens as ICobraToken*) pass }}} " nerdzero 4 Active Tickets 11 Selective DbC Compilation Cobra Compiler 0.8.0 enhancement assigned 2008-04-27T21:02:20Z 2008-05-08T10:05:43Z "When creating development code, one usually needs to make full use of preconditions, postconditions and invariants. The latter two help to prove that the algorithms in classes work as expected. In production code, the algorithms should be proven out to the best of the developers capabilities, and postconditions/invariants should no longer be needed. Because they imply overhead in terms of performance and size, it is beneficial to remove them. Preconditions though are always desirable because a class has no way of anticipating who its clients will be. My proposal is that command line options be added to Cobra to specify what assertions be compiled into the resultant application or library, but it isn't clear to me how these would look. Ideally it would be nice to have something similar to this: -contract:none -contract:all -contract:pre,post " Steve 4 Active Tickets 26 Recognize extension methods in dynamic binding Cobra Compiler 0.8.0 enhancement new 2008-07-06T01:17:17Z 2008-07-06T01:17:17Z "Dynamic binding uses CLR reflection which does not incorporate extension methods (whether from Cobra in .NET 2.0+ or C# in .NET 3.5+). However, it's not unreasonable that if a developer extends, for example, System.Object, that he be able to invoke extension methods when the type is dynamic. {{{ extend Object def aoeu as int return 4 class X def main is shared obj = Object() to dynamic assert obj.aoeu == 4 # fails to find method }}} " Chuck 4 Active Tickets 50 Warn about comparisons to the same variable Cobra Compiler 0.8.0 enhancement new 2008-10-21T02:14:45Z 2008-10-21T02:53:02Z "Comparisons to the same variable should cause a warning: {{{ if x == x if x == +x if x > x*1 }}} * It could be any of the comparison operators * The compiler should not be confused by identity operations such as +0, *1 and unary plus (+x); or by syntactic cruft like extra parenthesis. The warning should read: {{{ A comparison made to same variable. Did you mean to compare something else? }}} It might be desireable to extend this to properties, if we reach a decision that the Cobra compiler can assume that properties do not have side effects and that multiple threads are not allowed to mutate an object in parallel. If that assumption is too strong, we might consider a compiler flag for it. {{{ if x.name == x.name ... }}} " Chuck 4 Active Tickets 51 Warn about assignment made to the same variable Cobra Compiler 0.8.0 enhancement new 2008-10-21T02:52:12Z 2008-10-21T02:52:12Z "This is almost the same as ticket:50. Maybe it is the same except for the warning message? Anyway, warn for this: {{{ x = +x }}} " Chuck 4 Active Tickets 57 Provide a trace form without position info Cobra Compiler 0.8.0 enhancement Chuck assigned 2008-11-01T10:17:03Z 2009-08-31T13:05:32Z "Originally from [http://cobra-language.com/trac/cobra/ticket/32 ticket:32]. Support trace forms that a) dont display line position info (for easier tracking of expr values where code position is not interesting) b) display only an expressions value (rather than 'expr'=expr form) for providing simple text and interpolated strings in traces" hopscc 4 Active Tickets 68 Enable declarations to be marked as test support only Cobra Compiler 0.8.0 enhancement new 2008-11-10T09:59:20Z 2008-11-10T09:59:20Z "Then when -include-tests:no, these declarations would be excluded from code generation. Of course, if non-excluded code references them, that should be an error. {{{ class TestSupportAttribute has AttributeUsage(AttributeTargets.All, allowMultiple=false) inherits Attribute """""" Declarations marked as `TestSupport` will be excluded when the compiler is passed -include-tests:no. """""" pass }}} Cobra itself would benefit from this feature. " Chuck 4 Active Tickets 73 Support other versions of .NET past 2.0 Cobra Compiler 0.8.0 enhancement new 2008-11-16T00:16:27Z 2009-01-05T10:04:27Z "Should be able to target 3.0 and 3.5, for example. Some libraries are now requiring .NET 3.0 and higher, plus there are libraries from Microsoft that you might want to use. http://en.wikipedia.org/wiki/.NET_Framework_version_list " Chuck 4 Active Tickets 91 Bring in the Mono C# compiler backend Cobra Compiler 0.8.0 enhancement new 2008-12-11T11:35:05Z 2009-10-22T07:51:13Z "In April 2008, the Mono C# 2.0 compiler was released under the unrestrictive MIT license. Previous versions had been under GPL which was not compatible with Cobra's MIT license (we would have had to change it). See http://www.mono-project.com/news/archive/2008/Apr-08.html I believe the initial approach we can take for this ticket is the following: * Get the Mono mcs.exe compiler rebuilt as mono-sharp.dll * Ensure that mono-sharp.dll has public API calls to compile source code from memory (a .NET string) and to take options. * That eliminates disk I/O. * Have cobra.exe reference mono-sharp.dll and invoke it. * That eliminates process launching. The ability to generate C# to disk and invoke the compiler should be left in place for some time in case we find ourselves in need of it. " Chuck 4 Active Tickets 103 Support scientific notation ( numeric literals) Cobra Compiler 0.8.0 enhancement new 2008-12-20T09:55:11Z 2008-12-20T20:40:35Z "1e-10f see Discussion [http://cobra-language.com/forums/viewtopic.php?f=4&t=243 Problem with floating point literal]" hopscc 4 Active Tickets 112 Allow extra spaces for alignment inside line continuations only Cobra Compiler 0.8.0 enhancement new 2008-12-21T00:50:34Z 2013-04-25T15:13:32Z "This is a controlled violation of the ""you cannot mix tabs and spaces"" rule. An example: {{{ class X def fooBar(i as int, j as int) as int is shared return i + j def main is shared assert .fooBar(2, 3) == 5 }}} That example will make more sense when viewed in your editor. The ""j as int) ..."" line is indented with TABs like the rest of the source, but then 3 additional SPACEs are used to line up the `j` underneath the `i`. * 1 - 3 spaces * No more than 3 * Not allowed outside of line continuations * Also, cook up the same example with spaces only, no tabs. (In that case there is no such detection as ""1 - 3"" spaces.) * Test cases for TABs followed by 4 or more spaces producing an error. " Chuck 4 Active Tickets 126 Provide enumerate method (or similar) in CobraCore Cobra Compiler 0.8.0 enhancement Chuck accepted 2009-01-06T10:43:42Z 2009-01-10T15:22:51Z "Once you have multi arg assignment in for loops it seems its a common idiom to want to walk an IEnumerable and get back an item and its offset in the IEnumerable Currently to do this you need to wrap a counter around the IEnumerable forloop {{{ i as int = 0 for item in mylist doSomethingWith(i, item) i += 1 }}} While not difficult this is tedious and obscurative and generally 'clunky' In python this is provided with an .enumerate function {{{ myList = [ 'one"", 'two', 'three'] for i, item in enumerate(myList) doSomethingWith(i, item) }}} I propose we add a similar method to !CobraCore allowing something like {{{ myList = [ 'one"", 'two', 'three'] for i, item in CobraCore.enumerate(myList) doSomethingWith(i, item) }}} Pending pure functions or some form of default method lookup to a specified class ( !CobraCore ) this is probably as simple as we can get.... -------------------- Heres the implementation {{{ def enumerate(ie as IEnumerable) as IEnumerable is shared n=0 for e in ie yield [n, e] n += 1 def main is shared a = [1,2,3,4] l = .enumerate(a) l1 = for ii in l get ii assert l1 == [[0,1],[1,2],[2,3],[3,4]] for i,item in .enumerate(['a','b','c']) assert i in [0,1,2] assert item in ['a', 'b', 'c'] #print ""[i]:[item]"" kvpList = [KeyValuePair('x','aa'), KeyValuePair('y','bb'), KeyValuePair('z','cc') ] for i,kv in .enumerate({'x':'aa','y':'bb','z':'cc'}) assert i in [0,1,2] assert kv in kvpList #print ""[i]:[kv]"" }}} " hopscc 4 Active Tickets 137 Move to .Net 4.0: Add typed tuples to the language Cobra Compiler 0.9.4 enhancement new 2009-01-16T10:18:51Z 2013-05-29T14:03:37Z " * [http://cobra-language.com/forums/viewtopic.php?f=4&t=277&st=0&sk=t&sd=a&start=10#p1622 discussion forum] * http://www.digitalmars.com/d/2.0/tuple.html * http://stackoverflow.com/questions/152019/tuples-in-c * http://javatuple.com/ " Chuck 4 Active Tickets 159 Get Cobra working with .NET Compact Framework Cobra Compiler 0.8.0 enhancement new 2009-06-16T09:04:31Z 2013-06-11T08:16:54Z "To my knowledge, no one has tried. Obviously, this would entail an automated test case. " Chuck 4 Active Tickets 200 Cobra compiler options read from file Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-04-13T11:06:40Z 2010-06-02T04:52:14Z It would be convenient for large projects and setting common options once in one place if the cobra compiler would read options from a file but allow them (if duplicated) to be overridden with commandline entries. hopscc 4 Active Tickets 225 Support ganged or multivalue Cmdline Option with subOptions Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-07-30T12:25:08Z 2010-07-30T12:59:04Z "Some commandline options provide multiple tweaks around a single item (e.g testify-threads, testify-runner, testify-results affecting -testify). It would be convenient if rather than having multiple individual options for things like this we could specify a single option and provide a set of subOptions within it explicitly tying the subOptions to a single item (also supporting defaulting and convenient ganged settings) Useful also for setting things like metrics (enabling) and list of metrics (to be calculated) and arg provided to each metric to be done (threshold value). see [http://cobra-language.com/forums/viewtopic.php?f=4&t=643 Code Metrics Discussion]" hopscc 4 Active Tickets 245 Provide framework and implementation for some code metrics Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-08-13T12:06:13Z 2010-11-04T04:47:41Z "Provide access to some simple code metrics (!LinesOfCode and simple !McCabe/Cyclomatic Complexity calculation) done by Cobra compiler driven from compiler commandline option. Implement such that there is a reasonably accessible framework for adding additional metric calculations in the future. See [http://cobra-language.com/forums/viewtopic.php?f=4&t=643 Forum Discussion Utility of cobra compiler generating code metrics]" hopscc 4 Active Tickets 253 Provide some minimal allowance for use of multidim and jagged arrays Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-09-04T12:10:13Z 2010-09-04T12:52:51Z "Its currently almost possible to use multidimension (or jagged) arrays in cobra but the obvious way of doing this is stymied by the inability to explicitly declare the multidim or jagged array type. Rectify this (at a minimum) so that these types of arrays can be used in cobra (albeit not easily since Lists are better (:-)) In lieu of anything else I suggest using the C# syntax TYPE[][] for jagged TYPE[,] for multidimension and relying on a sharp fallthrough for constructor calls (I also dont see any reason ATM to support more than 3 Dimensions)." hopscc 4 Active Tickets 263 Provide Treaps implementation for cobra Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-11-03T12:17:10Z 2011-08-19T04:24:38Z As suggested in [http://cobra-language.com/forums/viewtopic.php?f=4&t=660 Sept-2010 help wanted] provide a cobra treaps implementation. hopscc 4 Active Tickets 272 Support generic declaration of sig (delegate) Cobra Compiler 0.8.0 enhancement new 2011-01-16T12:04:55Z 2011-01-16T12:04:55Z "If you try and declare a sig as a generic the compiler currently gives a parse error e.g. {{{ #!cobra sig Function( param as TParam) as TReturn }}} gives {{{ error: Encountered OPEN_GENERIC when expecting an identifier. }}} This should be allowed. See longer sample in ticket:271 (Torial) C# code at [http://labs.kaliko.com/2010/03/cache-functions-in-c-using-memoization.html] " hopscc 4 Active Tickets 275 More support for Java BackEnd Cobra Compiler 0.8.0 enhancement hopscc assigned 2011-02-11T11:41:05Z 2013-06-22T08:50:55Z "Placeholder ticket for patches to cobra for support of Java back end. -back-end:jvm Initially support compilation using javac in path and execution of resultant class file(s) (java in path). Flesh out !JavaGenerator so basic tests compile and run correctly. I'll be uploading a rolling patch for this, later patches will replace/supercede/include earlier patches. Probably code changes only, no additional tests." hopscc 4 Active Tickets 281 Correct cobra rtl String.count consistent with .Net Collections/Linq Cobra Compiler 0.8.0 enhancement Chuck assigned 2011-08-04T11:02:04Z 2011-08-25T10:24:51Z "see forum discussion post [http://cobra-language.com/forums/viewtopic.php?f=4&t=870 count vs length]. Chg count -> countOf, cleanup usage in compiler, correct tests and provide tests locking this down." hopscc 4 Active Tickets 290 Add DefaultDictionary.cobra to Cobra.Core Cobra Compiler 0.8.0 enhancement new 2012-08-05T16:09:08Z 2012-09-01T06:38:07Z fixed tryGetValue and added pro willRecordDefaults jaegs 4 Active Tickets 312 Support some form of conditional compilation Cobra Compiler 0.8.0 enhancement Chuck assigned 2013-01-08T13:45:14Z 2013-01-15T08:38:24Z "Allow Code to be conditionally compiled in cobra on at least: Debugging on/off Backend compiler in use OS platform Whether tests, assertions and contracts enabled or not. Perhaps also from a user defined setting passed to the compiler at compilation. Simplify greatly platform specific code ( backend or OS) layout. See also [http://cobra-language.com/forums/viewtopic.php?f=4&t=966 extending help directive forum topic]" hopscc 4 Active Tickets 327 Move to .Net 4.0: Generate C# lambdas for Cobra lambdas (Codegen) Cobra Compiler 0.9.4 enhancement new 2013-05-29T13:26:07Z 2013-05-29T13:26:07Z Change codegen to generate C# lambdas for cobra lambdas hopscc 4 Active Tickets 329 Move to .Net 4.0: Generate C# Automatic properties and Object Initializers for Cobra property inits (codegen) Cobra Compiler 0.9.4 enhancement new 2013-05-29T13:41:34Z 2014-02-05T01:05:24Z "Modify C# codegen to use newer (.Net 3.0) C# Object Initializers. (This is a replacement for the existing handling for auto property setting on Constructors) see [http://weblogs.asp.net/dwahlin/archive/2007/09/09/c-3-0-features-object-initializers.aspx C# 3.0 Features]" hopscc 4 Active Tickets 332 Ref and Lib paths need some platform pattern for 32 vs 64 bit Frameworks Cobra Compiler 0.9.4 enhancement Chuck assigned 2013-06-11T08:15:03Z 2013-06-15T08:06:54Z "On Windows/ .Net Ref and Lib paths are currently static and evaluated as in in cobra. That means the platform bit-width is wired to the ref/lib entry. Use on a different bit-width platform will fail with unfound path/files These need some way of specifying the 'framework place' independent of whether platform is a 32 or 64 bit platform. e.g paths: 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\...' vs 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\...' (at min some expansion pattern for 'Framework' vs 'Framework64'). Env var expansion is one possibility but then requires something else to set env var ( for platform type/bit width windows does not seem to do). .Net platform knows bit-width ( Environment.Is64BitProcess) so suggest some pattern that cobra compiler expands in ref and lib Paths e.g. '{Platform_Framework}' above two become '{Platform_Framework}\...' (cf %APP_DATA% ) " hopscc 4 Active Tickets 338 Cleanup codegen to minimise insertion of invariant/contracts boilerplate code Cobra Compiler 0.9.4 enhancement hopscc new 2013-07-11T14:46:28Z 2013-07-11T14:46:28Z "Cleanup contracts/invariant codegen so that classes that dont have contracts/invariants dont get (empty) contract code or boilerplate code inserted. Currently with contracts:inline ( default) exception trapping/checks boilerplate is inserted regardless. as is an invariantGuard variable. ( these should be suppressed where unneeded) For contracts:methods support boilerplate, methods calls are always inserted and empty methods are generated when there are no contracts/invariants. See short discussion on forum [http://cobra-language.com/forums/viewtopic.php?f=4&t=11145 Different Struct sizes] (hops: some suppression code done (for inline) min-inv-guard.patch needs checks for subclassing and library boundary)" hopscc 4 Active Tickets 339 Provide a nil safe dereference operator Cobra Compiler 0.9.4 enhancement Chuck assigned 2013-07-11T15:03:05Z 2013-09-04T11:22:54Z "Provide an operator that will allow deref through a chain of calls and member accesses even if something in the chain returns nil. (nilsafe/elvis operator) Like DOT operator but returns nil if prior element return nil See [http://cobra-language.com/forums/viewtopic.php?f=4&t=10230 Spaces around binary Ops] Preference for operator is '''?.''' (QUESTION_DOT), Operation is analogous to DOT except that a nil ref short ccts and returns nil for the expression (chain). {{{ #!cobra # raw: name is nil or trimmed capitalized string name = customer?.name?.trim.capitalized # w/nilCoalesce: name is empty string or trimmed capitalized string name = customer?.name?.trim.capitalized ? """" }}} Should handle non idempotent calls/derefs. If ambiguity between this and nil coalese op on trailing member ref then need space wrapped ops which should be done (if done) as a separate step." hopscc 4 Active Tickets 341 Require (some) binary operators to have spaces around them Cobra Compiler 0.9.4 enhancement new 2013-07-12T13:04:03Z 2013-08-03T09:18:00Z "In the interests of having canonical formatting in expressions, force some (subset) of the binary operators to only be accepted when have spaces around them e.g {{{ #!cobra # wrt ASSIGN(=) #rather than accepting name= a.b.foo # or name =a.b.foo # Only allow name = a.b.foo #must have at least one space fore and aft around the = }}} Discussion [http://cobra-language.com/forums/viewtopic.php?f=4&t=10230 Require spaces around Binary ops] Subset should probably include - math operators ( +,-,*, /, **, %) - Assignment(=) and (perhaps equals (==) ) - nil and nonnil coalesce (? and !) - Others?... This is a reasonably major change so should probably be compiler suppressible." hopscc 4 Active Tickets 320 Provide a tool to automate conversion of C# code to cobra code Cobra Compiler 0.9.3 task new 2013-05-03T08:22:59Z 2013-05-06T00:48:37Z "As per WishList provide a tool (cobra app or script) to automate the conversion of C# source code to equivalent cobra source code (or at least automate the easy 90% trivial deletions/changes) See list of manual changes in wiki:PortingC" hopscc 4 Active Tickets 146 bug when adding an extension method that is an overload of a BCL class Cobra Compiler 0.8.0 Cobra 0.9 defect jonathandavid assigned 2009-02-06T08:00:41Z 2009-02-24T05:50:13Z "Consider: {{{ extend String def split(chars as char*) as List return ['dummy'] class Foo def main is shared print 'a:b'.split(@[c':']) # Prints ['dummy'] }}} When the main method is executed, it looks as if the compiler is generating a call to my split(char*) extension method. This is wrong, because there is also a split(char[]) method in String that matches exactly the argument I'm passing. I think the problem only occurs when adding an extension overload to a BCL class because the problem does not show up when I try to reproduce it using a class written in Cobra: {{{ class Foo def bar(x as int[]) pass extend Foo def bar(x as int*) .bar(List(x).toArray) class Baz def main is shared Foo().bar(@[1, 2]) # correctly calls array version }}} " jonathandavid 4 Active Tickets 286 Invoke delegate property compiler error Cobra Compiler 0.8.0 Cobra 0.9 defect new 2012-08-02T21:25:21Z 2012-08-02T21:25:57Z " {{{ class X var _comparer as Comparison pro comparer from var cue init base.init _comparer = do(a as int, b as int) = a.compareTo(b) def main trace _comparer(5, 4) #works #trace .comparer(5, 4) doesn't compile #error: Cannot call ""comparer"" because it is a ""property"". #Should be equivalent to 'trace .comparer.invoke(5, 4)' #Cobra svn:2758 (post 0.8) / 2012-07-24 on Mono 2.10.9 CLR v4.0.30319 on Mac OS X 10.6.8 }}} " jaegs 4 Active Tickets 42 Provide platform independent line terminator metacharacter in strings Cobra Compiler 0.8.0 Cobra 0.9 enhancement Chuck assigned 2008-09-18T04:33:46Z 2009-08-31T12:35:37Z "Provide a metacharacter in strings that generates the correct line terminator string for the platform being run on. (Analogous to \t for tab, etc) See discusssion [http://cobra-language.com/forums/viewtopic.php?f=4&t=155 Platform independent line terminators]" hopscc 4 Active Tickets 52 Provide a compile-time form that emits an expression's source and value Cobra Compiler 0.8.0 Cobra 0.9 enhancement Chuck assigned 2008-10-21T23:00:02Z 2009-08-31T13:04:07Z "...without location/trace information. This ticket was broken out from ticket:32 See discussion at [http://cobra-language.com/forums/viewtopic.php?f=4&t=143 Tracing new expression and suppression] " Chuck 4 Active Tickets 110 Infer generic arguments for generic method calls Cobra Compiler 0.8.0 Cobra 0.9 enhancement new 2008-12-21T00:39:04Z 2008-12-21T00:39:04Z "See C# which already has this. We will too. " Chuck 4 Active Tickets 120 Support verbatim string notation Cobra Compiler 0.8.0 Cobra 0.9 idea Chuck assigned 2009-01-04T03:02:51Z 2009-09-02T10:38:49Z "have support for csharp verbatim string equivalent. " gauthier 5 Active Tickets 2 "Cannot use ""x in someList"" where x is dynamic?" component1 defect Chuck accepted 2008-03-16T21:42:02Z 2008-03-16T21:44:23Z "class X def main is shared x = 2 to dynamic? assert (x to int) in [1, 2, 3] # works assert x in [1, 2, 3] # error: Cannot convert type ""int?"" to ""int"" " Chuck.Esterbrook 5 Active Tickets 41 False warning for if statement on box var Cobra Compiler 0.8.0 defect Chuck accepted 2008-09-03T19:01:34Z 2008-09-14T06:34:12Z "{{{ class X def main is shared x = X() x.compute var _foo as X? def compute if _foo .bar if _foo # false warning here since .bar can change _foo .bar def bar _foo = nil }}} The warning is: foo.cobra(12): warning: The expression ""_foo"" (of type ""X"") will always evaluate to true because it is not nilable. You can remove the expression. This is low priority as it comes up rarely." Chuck 5 Active Tickets 44 Cobra always allows combining enum values even when not legal Cobra Compiler 0.8.0 defect new 2008-09-24T17:05:55Z 2008-09-24T17:05:55Z "Cobra allows enums to be combined (xor'ed) via `EnumName(MemberA, MemberB, MemberC)`. .NET enum types can have an attribute indicating if the enums can be combined. Cobra is not checking for that attribute and reporting an error (or warning?) if it doesn't exist. (I forget the name of the attribute off the top of my head.) " Chuck 5 Active Tickets 72 -test with -debug option leaves behind test-*.pdb/.mdb files Cobra Compiler 0.8.0 defect new 2008-11-11T00:05:30Z 2008-11-11T00:05:30Z "Using ""cobra -test -debug foo.cobra"" leaves behind extra files like test-200811100322.exe.mdb I saw this on Mono 2.0 with Mac OS X 10.4, but it probably happens on .NET and Windows as well. " Chuck 5 Active Tickets 141 Cannot effectively put more options after -turbo Cobra Compiler 0.8.0 defect nerdzero assigned 2009-01-27T00:50:33Z 2014-02-12T19:16:41Z "This command line will still exclude assert statements: {{{ cobra -turbo -include-asserts:yes foo.cobra }}} " Chuck 5 Active Tickets 142 problem when using an object variable of nilable generic type Cobra Compiler 0.8.0 defect assigned 2009-01-27T11:01:45Z 2012-09-27T04:09:49Z "The following program triggers a runtime assertion, complaining that myT is nil. It is as if the compiler did not realize that T is taking the value int?, and that therefore ""myT"" should be allowed to be nil. {{{ class G var myT as T class Program var g = G() def main is shared p = Program() }}} " jonathandavid 5 Active Tickets 157 Check for error: initializer cannot call itself Cobra Compiler 0.8.0 defect new 2009-06-07T03:46:12Z 2009-06-07T03:46:12Z "The test case: {{{ class Test cue init .init cue init(i as int) .init(0) def main pass }}} The errors: {{{ x-init-calls-itself.cobra(3): error: Constructor ""Test.Test()"" cannot call itself (C#) x-init-calls-itself.cobra(6): error: Constructor ""Test.Test(int)"" cannot call itself (C#) }}} These errors are dropping through to the C# compiler. Catch them in Cobra. " Chuck 5 Active Tickets 180 Optimization: Speed up use of literal collections Cobra Compiler 0.8.0 defect new 2009-10-03T01:45:54Z 2013-06-01T21:03:51Z "The program below demonstrates that Cobra's naive handling of something like: {{{ if s in ['a', 'b'], ... }}} is rather slow. This creates a burden on the developer to write lower level code to get better performance. {{{ use System.Diagnostics class P def main reps = 10_000_000 s = 'a' sw = Stopwatch() sw.start for i in reps if s in ['a', 'b', 'c', 'd', 'e', 'f'] s = 'a' sw.stop dur1 = sw.elapsedMilliseconds t = ['a', 'b', 'c', 'd', 'e', 'f'] sw.reset sw.start for i in reps if s in t # if s in List(t) s = 'a' sw.stop dur2 = sw.elapsedMilliseconds ratio = dur1 / dur2 trace dur1, dur2, ratio }}} Output: {{{ trace: dur1=16482 (Int64); dur2=464 (Int64); ratio=35.521551724137931034482758621 (Decimal); at x-literal-list.cobra:27; in P.main" Chuck 5 Active Tickets 191 False compilation error with .getType on a generic type Cobra Compiler 0.8.0 defect new 2009-11-17T10:32:53Z 2009-11-17T10:32:53Z "The following code gives a false compilation error: {{{ class Program def main .foo(String) .foo(String.getType) .foo(List) .foo(List.getType) # false error def foo(t as Type?) pass }}} The error: {{{ (10): error: For ""foo"" arg 1: The definition for ""List.getType"" is not a type. }}} Cobra has some special treatment of .getType which is no doubt the source of the problem. This is a low priority as passing the type directly (with no .getType) is the preferred coding style anyway. Cobra allows types to be passed directly, just like Python. " Chuck 5 Active Tickets 204 Infer correct types for lambdas and anon methods Cobra Compiler 0.8.0 defect Chuck assigned 2010-06-14T10:28:04Z 2010-06-14T11:01:44Z "Lambdas and anon methods/closures should have their types inferred correctly as method sigs not ""dynamic"" and anon method return type respectively. Probably should be a follow on from patch for ticket:39 using same method sig search and matching." hopscc 5 Active Tickets 210 Spaces after tabs should be allowed for implicit as well as explicit line continuation. Cobra Compiler 0.8.0 defect Chuck assigned 2010-07-04T14:03:47Z 2013-05-05T09:04:44Z "Space after tabs is not allowed in implicit line continuation and so currently requires the workaround of using explicit line continuation for vertical alignment where it needn't be. Test case: (Note: code doesn't display as intended here. Ok copied to editor with tabs=4) {{{ class X def foo(i as int, j as int) as int return i + j def main trace .foo(1, 2) trace .foo(1, 2) trace .foo(1, 2) }}} {{{ test.cobra(11): error: test.cobra(11,1): error: Cannot mix tabs and spaces in indentation. [TAB][TAB][TAB][TAB][SPACE][SPACE][SPACE]... }}} " nevdelap 5 Active Tickets 224 'use' statements in partial class files dependent on order on compile command line. Cobra Compiler 0.8.0 defect new 2010-07-26T18:52:21Z 2012-12-12T02:25:06Z "With partial classes use statements have to be in the first of the class' files to be compiled, rather than in the file that needs the use. See also: http://cobra-language.com/forums/viewtopic.php?f=4&t=644" nevdelap 5 Active Tickets 231 all/for in invariant causes COBRA INTERNAL ERROR Cobra Compiler 0.8.0 defect new 2010-08-01T21:04:11Z 2014-01-24T22:37:48Z " {{{ class A pass class B var _list as List var _dict as Dictionary invariant all for a in _list get a in _dict.keys }}} # error: COBRA INTERNAL ERROR / InvalidOperationException / Operation is not valid due to the current state of the object " nevdelap 5 Active Tickets 232 Small inconsistency in 'if a inherits B' semantics. Cobra Compiler 0.8.0 defect new 2010-08-02T15:37:41Z 2010-09-03T19:14:18Z "Once the 'a inherits B' is found to be true and a is allowed to be used as a B it would be nice if it was allowed in subsequent parts of the same expression rather than needing to wait until the next statement. The second and third if statements here are the example. In other words 'if x, if y, do something' should be equivalent to 'if x and y, do something'. I hope I'm being clear enough. {{{ class A pass class B inherits A pass class P var _list as List is shared def main is shared a as A = B() #_list.add(a) No allowed, ok. if a inherits B _list.add(a) # Magically allowed by Cobra. if a inherits B if not _list.contains(a) # Ditto. _list.add(a) if a inherits B and not _list.contains(a) # error _list.add(a) }}} error: Argument 1 of method ""contains"" expects type B?, but the call is supplying type A." nevdelap 5 Active Tickets 235 "A numeric literal ending in . such as ""2."" gives a cryptic error message" Cobra Compiler 0.8.0 defect new 2010-08-06T11:30:26Z 2010-08-06T11:30:26Z "The expression ""2. * x"" should either work or give a good error message, rather than ""Expecting an expression"". " Chuck 5 Active Tickets 236 Specifying -test and -compile-if-needed gets ArgumentOutOfRangeException. Cobra Compiler 0.8.0 defect Chuck assigned 2010-08-07T23:44:36Z 2010-09-04T13:28:32Z " {{{ class P def main is shared test assert false body print 'hello' }}} {{{ nev@bananinha:~/Temp/cobra$ cobra -test -compile-if-needed test.cobra An unhandled exception has occurred. Cobra debugging tips: To get file name and line number information for the stack frames, use: cobra -debug foo.cobra If running the executable through ""mono"" then also use --debug (double dash): mono --debug foo.exe ... To get a post-mortem, HTML-formatted report with more details about your objects: cobra -debug -exception-report foo.cobra For even more information, try: cobra -debug -exception-report -detailed-stack-trace foo.cobra Or use the abbreviations: cobra -d -er -dst foo.cobra Unhandled Exception: System.ArgumentOutOfRangeException: Argument is out of range. Parameter name: index at System.Collections.Generic.List`1[Module].get_Item (Int32 index) [0x00000] at Cobra.Lang_ert_b6e375e3164366f1086afa629ec24c88.Extend_IList__T__ExtendList.Last[Module] (IList`1 _lh_this) [0x00000] at Compiler.ComputeOutNameSharp () [0x00000] at ClrBackEnd.ComputeOutName () [0x00000] at Compiler.CompileFilesNamed (IList`1 paths, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] at CommandLine.DoCompile (System.Collections.Generic.List`1 paths, Boolean willPrintSuccessMsg, Boolean writeTestInvocation, System.Predicate`1 stopCompilation) [0x00000] at CommandLine.DoTest (System.Collections.Generic.List`1 paths) [0x00000] at CommandLine.Run (System.Collections.Generic.List`1 args) [0x00000] at CommandLine.Run () [0x00000] at CobraMain.Main () [0x00000] }}} " nevdelap 5 Active Tickets 241 -test tests runtime with -ert Cobra Compiler 0.8.0 defect new 2010-08-08T19:29:57Z 2010-08-09T11:52:47Z "Reproduce: 1. write some code with tests 2. {{{cobra -test code.cobra}}} runs only those tests 3. {{{cobra -test code.cobra -ert}}} also runs 20 Cobra runtime tests, which clog up the output window. Expected: -ert does not change the output of the program. Running the tests but suppressing their output would be fine. Result: Oh no, it's running a bunch of tests I didn't write! Now I have to read a bunch more to find where my errors are!" Kurper 5 Active Tickets 244 Cobra gets itself into a state where it puts single quotes around all the strings it is outputting. Cobra Compiler 0.8.0 defect new 2010-08-11T21:36:11Z 2010-08-11T21:36:11Z "These is reproducible in my app while running its tests, but I haven't managed to boil it down into something small enough to post to demonstrate the problem. When I manage that I'll add it to the ticket. This mickey mouse little toString, where I'd put a print and a couple of traces... {{{ def toString as String is override and ensure result <> '' body print '--------------' s = _name trace _name, _type if _type <> '' s += ':[_type]' trace s return s }}} Produces this output when running my tests. You'll see that the first three times it is called it prints correctly, then subsequently it is adding lots of extra quotes around everything it is outputing - not just around my _name and _type strings, so it's not that they have garbage in them. {{{ -------------- trace: _name='def'; _type='int'; at Parameter.cobra:67; in Parameter.toString trace: s='def:int'; at Parameter.cobra:70; in Parameter.toString -------------- trace: _name='abc'; _type=''; at Parameter.cobra:67; in Parameter.toString trace: s='abc'; at Parameter.cobra:70; in Parameter.toString -------------- trace: _name='def'; _type='int'; at Parameter.cobra:67; in Parameter.toString trace: s='def:int'; at Parameter.cobra:70; in Parameter.toString << test 1: .toString_ol_1_11581 >> test 2: .parse_ol_1_11744 '--------------' trace: '_name'=''abc'''; ''_type'='''''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString' trace: 's'=''abc'''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString' '--------------' trace: s='abc'; at Parameter.cobra:77; in Parameter.parse trace: s='zyx:int'; at Parameter.cobra:77; in Parameter.parse '--------------' trace: '_name'=''abc'''; ''_type'='''''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString' trace: 's'=''abc'''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString' '--------------' trace: '_name'=''zyx'''; ''_type'=''int'''; 'at 'Parameter.cobra':67'; 'in 'Parameter'.'toString' trace: 's'=''zyx:'int''''; 'at 'Parameter.cobra':70'; 'in 'Parameter'.'toString' }}} What triggers it is a line elsewhere also added just for debugging... {{{ print visibility, name, parameters, type }}} in the parse method being tested when the next four calls to it produce the other four outputs, where Visibility is an enum, name and type are strings, and parameters is a list of Parameter, the class with the above toString method. So I'll try to come up with something small that demonstrates the whole problem, which I've been trying to do for while without success so far - but I thought I'd flag it in a ticket, and maybe from this output you might have a inkling." nevdelap 5 Active Tickets 256 This code not implementing all interfaces' methods compiles a broken assembly. Cobra Compiler 0.8.0 defect new 2010-09-09T19:58:07Z 2010-10-24T07:25:01Z "This code is incorrect because it doesn't implement IEnumerable.getEnumerator but it compiles. {{{ use System.Collections use System.Collections.Generic namespace Test class ReadOnlyList implements IEnumerable, IEnumerable var _list as IList cue init(list as IList) test ints = ReadOnlyList(List(@[1, 2, 3, 4])) assert ints.count == 4 assert ints.contains(1) assert ints.indexOf(3) == 2 assert ints[2] == 3 assert ints.isReadOnly total = 0 for i in ints total += i assert total == 10 body base.init _list = list get count as int return _list.count def contains(item as T) as bool return _list.contains(item) def indexOf(item as T) as int return _list.indexOf(item) get [index as int] as T return _list[index] get isReadOnly as bool return true def getEnumerator as IEnumerator? return _list.getEnumerator }}}" nevdelap 5 Active Tickets 267 Cobra Enums not support methods of Enum Baseclass Cobra Compiler 0.8.0 defect new 2010-12-06T10:28:56Z 2013-03-29T05:15:36Z "The .Net [http://msdn.microsoft.com/en-us/library/system.enum.aspx Enum] baseclass have a few none static methods and a plethora of static methods for obtaining member names and values and doing conversions. Cobra Enums dont recognise these methods. {{{ #!cobra #access to Enum methods via cobra enum class EnumMethods enum Days Mon,Tues,Wed, Thurs, Fri, Sat, Sun enum States has Flags None=0, Invalid=1, Settling=2, Valid =4 def main is shared d = Days.Mon weekend = Days(Sat, Sun) inweekend = d in Set([Days.Sat, Days.Sun]) print '[d] in weekendSet', inweekend #static print Enum.getName(Days, d) print Days.getName(Days, d) # shd work doesnt compile print Enum.getNames(Days) print weekend s = States() print Enum.getNames(States) print Enum.getValues(States) assert s inherits Enum print s.getNames(States) # shd work doesnt compile print s.getValues(States) # shd work doesnt compile print s.hasFlag(States.Invalid) # doesnt compile s = States.Settling s1 = s to Enum # spurious warning print s1.hasFlag(States.Invalid) # cant see hasFlag print s1.typeOf }}} " hopscc 5 Active Tickets 306 Unable to insert underscores into some numeric literals Cobra Compiler 0.8.0 defect new 2012-11-07T14:39:26Z 2012-11-07T16:24:04Z Decimal portion after period and hex literals could use underscores too. Nefarel 5 Active Tickets 333 Implementing ITestRunListener is a little awkward Cobra Compiler 0.9.4 defect new 2013-06-18T13:30:37Z 2013-06-18T13:30:37Z "This is nothing major. Just thought I would bring it up. It can be closed as ""won't fix"" and it wouldn't bother me :) I've been playing around with a custom test runner and listener for the MonoDevelop add-in and noticed that the interface suffers from some name collisions. The abstract 'Test' class is in a 'Test' namespace which means the implementing class must qualify the parameter typename as 'Test.Test'. You cannot just 'use Cobra.Core.Test' because then 't as Test' doesn't resolve to the class name. Also, should the methods 'testStarted' and 'testEnded' be accepting 't as ITest' instead? What about 'suiteStarted' and 'suiteEnded'? For reference: http://cobra-language.com/trac/cobra/browser/cobra/trunk/Source/Cobra.Core/Test.cobra" nerdzero 5 Active Tickets 359 Confusing interaction between Object? instance and bools Cobra Compiler 0.9.6 defect new 2014-01-31T16:31:02Z 2014-02-01T11:18:42Z "reported-by: kobi7 The last assertion in the following program fails {{{ class NilableObjectAsBool def main shouldBeFalse as Object? = false assert shouldBeFalse == false shouldBeTrue = not shouldBeFalse assert shouldBeTrue == true }}} The value of shouldBeTrue actually ends up being 'false'. This is probably because the nilable object has a non-nil value so 'not shouldBeFalse' is returning false. This is confusing when just examining the code especially if the type of the local variable is inferred from a method call that returns an Object?, It also confusing when adding 'assert shouldBeFalse == not shouldBeFalse' to the program and the assertion passes. This may be by design or unfixable in which case this ticket can be closed." nerdzero 5 Active Tickets 363 -turbo should default disable -dst (?) Cobra Compiler 0.8.0 defect new 2014-02-10T03:03:17Z 2014-02-10T03:03:17Z "-turbo is a catchall for enabling/disabling other options to make a max-speed executable. Theres a comment [http://cobra-language.com/forums/viewtopic.php?f=4&t=17265#p22663 here] suggesting that it should also disable -detailed-stack-trace (though I think that is default off anyway so you would have to have it explicitly specified AND -turbo and make it go away ... ) (It may be preferable to correct -dst code gen so it doesnt cause code gen errors on 'structs')" hopscc 5 Active Tickets 366 Compiling the same file twice Cobra Compiler 0.9.6 defect new 2014-03-01T06:17:42Z 2014-03-01T06:17:42Z "This: {{{ > cobra foo.cobra foo.cobra }}} Will have Cobra trying to compile the same file twice which leads to confusing errors about duplicate declarations. There should instead be an error that the same file was specified twice, or a warning that the 2nd instance of the file is being ignored. " Charles 5 Active Tickets 371 MSBuild Task: error if no assembly references in .cobraproj file Cobra Compiler 0.9.6 defect new 2014-06-29T14:46:50Z 2014-07-04T21:33:26Z "On Windows, using ""msbuild.exe"" with a file ""X.cobraproj"" without any assembly references, for example {{{ }}} causes this error message: {{{ ...Cobra.targets(149,3): error MSB6001: Invalid command line switch for ""cobra.bat"". Value cannot be null. [...X.cobraproj] ...Cobra.targets(149,3): error MSB6001: Parameter name: collection [...X.cobraproj] }}} '''Steps to reproduce the failure''': call {{{ msbuild X.cobraproj }}} where ""X.cobraproj"" is this file {{{ Hello Exe }}} and ""Hello.cobra"" is this file: {{{ class Program def main is shared print ""Hello!"" }}} Note: The above ""X.cobraproj"" works with ""xbuild.exe"". With ""msbuild.exe"" it only works with an assembly reference, for example: {{{ ... ... }}} " thriwkin 5 Active Tickets 372 "MSBuild Task: a file ""cobra"" in the project directory causes and error on Windows." Cobra Compiler 0.9.6 defect new 2014-06-29T19:25:22Z 2014-06-29T19:56:15Z "- On Windows, - running ""msbuild.exe"" or ""xbuild.exe"" fails - with a correct ""X.cobraproj"" and - a file ""cobra"" in the same directory or in a subdirectory ""bin"". {{{ msbuild /t:Rebuild X.cobraproj ==> ...Cobra.targets(149,3): error MSB6003: The specified task executable ""cobra"" could not be run. The specified executable is not a valid application for this OS platform. [...X.cobraproj] }}} {{{ xbuild /t:Rebuild X.cobraproj ==> ...Cobra.targets: error : Error executing tool '...cobra': ApplicationName='...cobra', CommandLine=... CurrentDirectory=... Native error= %1 is not a valid Win32 application. }}} '''Reproduction''': An example of this scenario: The directory ""Source"" of the Cobra compiler source (svn-3116) contains - the ""cobra.cobraproj"" file - and the file ""cobra"", a bash script. A ""Rebuild"" command, given in the Cobra IDE or on the commandline {{{ msbuild /t:Rebuild cobra.cobraproj }}} produces 2 failures: First it fails because the .cobraproj file does not contain any assembly reference -- see ticket:371 After having inserted an assembly reference, it fails because the directory of the ""cobra.cobraproj"" file contains the file ""cobra"". Moving the file ""cobra"" into a subdirectory ""bin"" does not help. After having renamed this file, e.g to ""(cobra)"", all works well. " thriwkin 5 Active Tickets 6 Add class methods Cobra Compiler 0.7.4 enhancement new 2008-04-13T18:44:51Z 2008-11-10T23:49:16Z "See the #4 item at http://cobra-language.com/forums/viewtopic.php?f=4&t=112 for details. " Chuck.Esterbrook 5 Active Tickets 8 Use of old For statement should generate a deprecation warning Cobra Compiler 0.7.4 enhancement Chuck assigned 2008-04-23T11:37:36Z 2009-08-31T12:53:01Z "Since the old for statement ( for v = start .. stop) is deprecated its use should cause notification of that fact and a suggestion on how to correct for it" hopscc 5 Active Tickets 23 Invoke DLR during dynamic binding Cobra Compiler 0.8.0 enhancement new 2008-07-03T20:31:15Z 2008-07-03T20:31:15Z "If possible, dynamically detect and use the DLR during dynamic binding. Currently, Cobra only uses CLR reflection for dynamic binding. This works find for objects created from Cobra, C# and VB, but will not leverage objects from dynamic languages such as IronPython and IronRuby. The code for dynamic binding is found in CobraLang.cs in the CobraImp class. Ideally, the use of DLR would be dynamic such that it does not become a requirement for deploying Cobra programs." Chuck 5 Active Tickets 29 Support other types of integer literals, and underscores Cobra Compiler 0.8.0 enhancement Chuck assigned 2008-07-13T02:37:09Z 2009-08-31T12:55:07Z """0o"" for octal. ""0b"" for binary. Support underscore separators in integer literals regardless of their base. This is already supported in the ""standard"" integer literals like ""1_000_000"". " Chuck 5 Active Tickets 39 Infer types for method references Cobra Compiler 0.8.0 enhancement Chuck assigned 2008-08-25T15:25:48Z 2014-02-16T20:55:27Z "Types for method references are not inferred. For example: {{{ x = X() m = ref x.bar # error: Cannot infer type for ""m"" because # the type of the right hand expression is unknown. }}} Cobra should infer the type. A search for a compatible type sig should start in the current box and proceed out to the declared and used namespaces. If no match is found, a private, generated method sig should be created. " Chuck 5 Active Tickets 49 Nested methods Cobra Compiler 0.8.0 enhancement new 2008-10-17T22:19:53Z 2008-11-10T23:52:05Z Cobra at present does not implement nested methods which are useful for closures and other issues relez 5 Active Tickets 65 Suggest System.Text.RegularExpressions when appropriate Cobra Compiler 0.8.0 enhancement new 2008-11-10T09:50:33Z 2008-11-10T09:50:33Z "When an unknown type/id of ""Regex"" or ""!RegEx"" is used, suggest to the user: {{{ use System.Text.RegularExpressions }}} To speed them along their way. " Chuck 5 Active Tickets 79 "Command line ""resource"" options" Cobra Compiler 0.8.0 enhancement new 2008-11-16T07:31:06Z 2008-11-16T07:31:06Z "Implement the various ""resource"" options of the C# compiler: -linkresource:FILE[,ID] Links FILE as a resource (short: -linkres) -resource:FILE[,ID] Embed FILE as a resource (short: -res) -win32res:FILE Specifies Win32 resource file (.res) -win32icon:FILE Use this icon for the output Ideally, make sure they work (or at least compile) on both .NET and Mono. Currently, users can work around this deficiency with the -sharp-args option. See cobra -h for help. " Chuck 5 Active Tickets 80 Warn for poorly placed underscores in numbers Cobra Compiler 0.8.0 enhancement new 2008-11-16T07:34:02Z 2008-11-16T07:34:02Z "Underscores can be used in numeric literals to separate thousands. Examples include 10_000 and 1_000.5. Give a warning if the placement of underscores does not make sense such as 10_00.5. After all, the underscores are to increase readability and 10_00 does not do that. " Chuck 5 Active Tickets 81 Library: Operating system sniffer Cobra Compiler 0.8.0 enhancement new 2008-11-16T07:40:35Z 2008-11-16T07:40:35Z "Create an operating system sniffer that comes back with info like ""Mac OS X"", ""10.4.3"" or ""CentOS"", ""5.1"" etc. This would be a library call like `CobraCore.probeOperatingSystem`. `Environment.osVersion` tells me my mac box is ""Unix 8.11.1.0"" which is less informative if I'm looking at output from someone else's system. This sniffer would get invoked when running ""cobra -v"" Properties of the result could include .brand ""Apple"", .name ""Mac OS X"", .version ""10.4.11"", .systemVersion ""8.11.1.0"" and .family ""Unix"". Also, .subversion for Windows (""SP2"") and anything else appropriate. " Chuck 5 Active Tickets 99 Implement contracts with Microsoft code contracts Cobra Compiler 0.8.0 enhancement new 2008-12-15T06:28:03Z 2008-12-19T21:21:14Z "Microsoft is working on standardized support for code contracts in .NET languages. Cobra should embrace this, but still support its current facilities for 2 reasons: * There could be differences in semantics around contracts, such as how inheritance is handled. We don't want to break existing programs (including the Cobra compiler). * There is no just standard on JVM where Cobra's current facilities will be needed. " Chuck 5 Active Tickets 115 "Support StringBuilder as a target for ""print to X, ...""" Cobra Compiler 0.8.0 enhancement Chuck assigned 2008-12-23T10:26:01Z 2008-12-24T00:10:40Z "{{{ print to X, 'Hello, [name].' }}} Cobra supports X being a !TextWriter. It should also support X being a !StringBuilder. " Chuck 5 Active Tickets 118 "Improve error message for generic type names that are missing ""of""" Cobra Compiler 0.8.0 enhancement new 2009-01-01T03:16:24Z 2013-07-03T14:45:12Z "{{{ class X def main is shared d = Dictionary() # error: Expecting an expression. t = List() # error: Expecting an expression. }}} The error message should instruct the user that if they are naming a generice, then they are missing ""of"". Also, catch this problem in declarations such as `inherits List` and `def foo as List` " Chuck 5 Active Tickets 123 support for property with different access modifier visibility Cobra Compiler 0.8.0 enhancement new 2009-01-05T02:43:11Z 2009-01-05T09:52:46Z "c# has them: {{{ abstract class C { public abstract object Prop { get; protected set; } } }}} could be {{{ class C is abstract pro prop get is public set is protected }}}" gauthier 5 Active Tickets 144 Add units of measurement Cobra Compiler 0.8.0 enhancement new 2009-02-04T13:42:48Z 2009-02-04T13:43:57Z "As in ""pounds"", ""cm^3"", etc. Add these at least at the library level, but potentially at the language level. Please feel free to add comments to this ticket including interesting links, proposed ways to do implement it, syntax, etc. " Chuck 5 Active Tickets 145 complete the collection of string.split extension methods Cobra Compiler 0.8.0 enhancement jonathandavid accepted 2009-02-05T07:38:16Z 2009-02-10T20:39:24Z ".NET's core string class has versions that take the separators as a char[]. Cobra's January 09 update adds extension methods that take a List separator instead, which is more convenient. Currently missing: * All the versions that take the max. number of tokens in addition to the separators. * Versions that take the separator as a string (this is the easiest to use). * Versions that take the separator as char* (this is the most generic way, the more specific ones would be left mainly for efficiency). The char* version would probably lead us to remove the one that currently takes a IList. See forum thread: [http://cobra-language.com/forums/viewtopic.php?f=4&t=292&p=1727#p1727] " jonathandavid 5 Active Tickets 149 Simplifying internal class VariType Cobra Compiler 0.8.0 enhancement jonathandavid accepted 2009-02-10T16:13:27Z 2009-02-11T16:51:21Z "Right now, objects of VariType read from a CLR DLL have the following structure. VariType[T] = NilableType[ArrayType[T]] The Class[T] notation I've just made up means that Class inherits from WrappedType, and has T as its _wrappedType instance var. (Note that native Cobra vari params don't have this problem, as they are created with the much more logical structure VaryType[T] = T) I see one problem with the structure above, namely that ArrayType layer is redundant; it should be implicit from the fact that we are dealing with a vari parameter. In a previous ticket I objected to the NilableType part as well, but once we remove the ArrayType layer we will be left with: VariType[T] = NilableType[T] Now I think that this makes sense, since the arguments passed as vari parameters can be nil. For example: ""1 2"".split(@[1, nil]) The goal of this ticket, thus, is to change the way vari params are read from CLR DLLs, so that the ArrayType layer is not added. 2) The NilableType part is mislocated As you can imagine, the code to extract the T from a VariType31 gets quite convoluted. Why not have VariType32 as VariType33[T] = WrappedType34[T]? If case some of the functionality of ArrayType?35 is needed, why not have VariType36 inherit from ArrayType?37? And most important, why put that Nilable layer in the middle? " jonathandavid 5 Active Tickets 172 Provide an interactive mode for Cobra (REPL) Cobra Compiler enhancement new 2009-07-23T12:43:22Z 2010-12-03T09:57:44Z "REPLs are great for rapid prototyping, and learning the language. Most major languages provide one so it's only fitting that Cobra does too. This can probably be done easier after the use of the Mono libraries are integrated. This interactive mode will be entered when `cobra` is invoked without the `-files` option or source files." webnov8 5 Active Tickets 179 support shared access modifier on class definitions Cobra Compiler 0.8.0 enhancement Chuck assigned 2009-09-29T02:03:47Z 2013-03-21T12:39:22Z "as in {{{ class Foo is shared }}} More for completeness/symmetry than anything else. see [http://cobra-language.com/forums/viewtopic.php?f=4&t=463 Static Class Problem]" hopscc 5 Active Tickets 193 Extension to HowTo/29[02]* to include shell sort Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-01-19T10:52:48Z 2010-06-29T11:46:36Z "Heres a patch to the sort examples in HowTo/29[02]-TranslatePseudoCodeToCobra[12].cobra to include an example of a shellsort." hopscc 5 Active Tickets 230 "make ""a = []"" do the right thing when a is of a known type" Cobra Compiler 0.8.0 enhancement Chuck assigned 2010-07-31T05:44:48Z 2014-03-05T10:10:12Z "var a as List? (...) a = [] would be nice to be able to do. Same for dicts/sets, presumably." Kurper 5 Active Tickets 269 Add Enum handling features Cobra Compiler 0.8.0 enhancement new 2010-12-11T11:32:10Z 2010-12-11T11:32:10Z "1) Add a capability to the declaration of a cobra enum to specify that they have the 'Flag' attribute and their members are automatically initialised to bitset values Suggestion was an attribute '!BitSetFlag' or '!AutoBitSetFlag' {{{ #!cobra enum Colors has AutoBitSetFlag None, Red, Green, Blue, Yellow # which would generate code equivalent to the explicitly detailed enum Colors has Flag None = 0, Red = 1, Green = 2, Blue = 4, Yellow = 8 }}} ( member values start from 0 and double (per a bitset setting) for each successive value) 2) Overload the processing for an 'in' expression so that 'in' on an enum value and combined bitset gets converted to a valid set inclusion test optimised for whether the enum is a bitset or not e.g. {{{ #!cobra primaries = Colors(Red,Green, Blue) c = .getColor if c in primaries }}} gets converted to the equivalent of {{{ #!cobra if primaries.hasFlags(c) # c & primaries == c }}} if Colors is declared as a bitset with Flags (either explicitly or as above) and {{{ #!cobra if c in Set([Colors.Red, Colors.Green, Colors.Blue]) }}} if not See ticket:265 " hopscc 5 Active Tickets 282 Useful compile error (when misusing generics) Cobra Compiler 0.8.0 enhancement new 2011-12-16T05:49:47Z 2013-07-03T14:47:54Z "I work primarily in C#, and so I get used to the C# way of doing generics such as List, and forget the ""of"" keyword. When this happens, I get an error: ""Expecting an expression"" which doesn't really help much and if I'm not remembering this particular issue, I will sometimes hunt down rabbit trails. If the error message could check to see if angle brackets are used, and then use a message like ""Improper generic usage. Use genericType format."" I think it would be helpful." torial 5 Active Tickets 300 allow to chain a few exceptions with a single body Cobra Compiler 0.8.0 enhancement new 2012-10-28T14:30:06Z 2012-10-28T20:00:23Z " can I chain a few exceptions with a single body? catch SysException | XException | YException body of catch statement, that fits all of them nope they have to be separate catches in that case, the body is duplicated you could break it out to a separate method also in the case of ""catch x as SysException | XException | YException"" there is the question of what type to give to ""x"" ofcourse. I saw that syntax in a java proposal, maybe it got to java7. thought it's a nice addition http://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html ... so i presume you can use methods on ""ex"" that the two types have in common, but they don't spell that out and they don't show an example also since .net doesn't have this feature, we'd have to map it. presumably by generating each ""catch"" block on behalf of the programmer I guess the type of ""ex"" could be the greatest common denominator of all the types the Cobra compiler already has code to compute such a thing because it is used in other places, like inferring the inner type of a list literal if you don't want me to lose track of this idea, fill out a ticket at the cobra web site. :-)" kobi7 5 Active Tickets 305 Add restrictions for underscores in numeric literals Cobra Compiler 0.8.0 enhancement new 2012-11-07T14:37:41Z 2012-11-07T14:37:41Z "This should not be allowed: Underscores at the end of the number. {{{ 537_ 0x45_ }}} Multiple underscores between digits {{{ 37______35__26 }}} Underscores adjacent to decimal point {{{ 72_.435 }}} In short only valid place for underscore should be between digits. " Nefarel 5 Active Tickets 315 cobra support multiple return values Cobra Compiler 0.9.3 enhancement Chuck assigned 2013-01-20T14:18:22Z 2013-01-25T12:15:17Z "(Feature placeholder) Multiple return values on methods using simple and obvious syntax (slight extension to existing) for method return type declaration and return values. {{{ a,b = .fn(123, 'xyz') assert a.typeOf == int assert b.typeOf == String def fn(i as int, s as String) as int, String # lotta calc return i, s }}} See [http://cobra-language.com/forums/viewtopic.php?f=4&t=1050 forum Topic Multiple Return values] " hopscc 5 Active Tickets 319 Move to .Net 4.0: Cobra dynamic codegen should use 'dynamic' type Cobra Compiler 0.9.3 enhancement new 2013-04-26T10:07:22Z 2014-02-04T18:29:37Z "Cobra devolves untyped or 'dynamic' typed variables to Object on C# codegen due to lack of any other reasonable 'dynamic' equivalent. This works fine so far as it goes but can lead to some oddities (see ticket:249) .Net 4.0 supports a 'dynamic' type itself so cobra should use that when built/genned/running against/supporting .Net 4.0. (This ticket pulled from ticket:249 and separately recorded as an eventual enhancement)." hopscc 5 Active Tickets 322 Support immutable/readOnly on class decl Cobra Compiler 0.9.3 enhancement new 2013-05-14T08:28:35Z 2013-05-14T08:28:35Z "Support 'is readonly' modifier at a class level declaration. Its effect is to make any all var fields as if they had each been specified with 'is readonly' which means that these var values can only be specified or changed at point of declaration or in the classes constructor. Net effect is to provide convenience decl of a simply specified immutable class. see [http://cobra-language.com/forums/viewtopic.php?f=4&t=2541 Discussion:Does cobra have special syntax for immutable types ]" hopscc 5 Active Tickets 328 Move to .Net 4.0: Support Co and ContraVariance Cobra Compiler 0.9.4 enhancement new 2013-05-29T13:32:25Z 2013-05-29T13:32:25Z "C# 4.0 supports defining co and contravariance on Generic Interfaces and Delegates. Augment cobra parsing and codegen to do same Hopefully it will just be a passthrough cobra syntax to C#. see [http://www.codeproject.com/Articles/37795/C-4-0-s-New-Features-Explained] '''Co and Contra Variance''' Cobra syntax should probably be an optional tag ('in', out') before generic Type placeholder definition." hopscc 5 Active Tickets 350 Handle more forward references in `var` initialization expressions Cobra Compiler 0.9.6 enhancement new 2014-01-03T05:40:21Z 2014-01-03T05:40:21Z "This forward reference: {{{ #!cobra class A var _foo = B.bar class B def bar as String is shared return '' }}} Gives this error: {{{ error: Cannot compile initialization expression at this point. Add an explicit type to the `var` (""as "") or move to a `cue init` or change the expression. }}} Ideally, Cobra would handle this particular forward reference (and similar ones) since it looks fairly simple. Further notes: There is no equivalent C# because C# has no ""var"" type inference at the member var level, nor ""from var"" for declaring properties. The closest C# is this: {{{ class A { protected string _foo = B.Bar(); } class B { public static string Bar() { return """"; } } }}} Which works fine, but so does the equivalent Cobra: {{{ var _foo as String = B.bar }}} See ticket:349 for the original report on this, back when Cobra produced an internal error rather than a normal, informative error. Fix was in changeset:3093 and shows where the relevant code is--the call of _initExpr.bindImp from the _bindInt of !BoxField. " Charles 5 Active Tickets 229 -files: could use more power Cobra Compiler 0.8.0 idea new 2010-07-31T04:51:15Z 2010-08-09T12:03:28Z "I have multiple projects share substantial portions of their codebase (client/, shared/, and server/, basically), and being able to do something like: sharedfiles.txt: ... clientfiles.txt: #include sharedfiles.txt client.cobra serverfiles.txt: #include sharedfiles.txt server.cobra would be nice. There are a bunch of ways to fake this with make/msbuild/whatever else you want to use, but it's nice being able to run Cobra with just ""cobra -files:files.txt"" even for big ol' projects." Kurper 5 Active Tickets 278 implanting Doc-strings inside Attributes to keep them in code to be readily assesed while programming Cobra Compiler 0.8.0 idea Charles new 2011-03-10T07:11:31Z 2011-03-10T07:15:03Z "GentleMen i propose that doc-strings be implanted within the programm as attributes on c# side or are they allready.so that one can recover them programmatically for instance {{{ def func """""" def doc-string"""""" }}} on csharp side {{{ [CobraDocStringAttribute(""def doc-string"")] void func() {} }}} so while using the assembly one can get it logically like this if method has CobraDocStringAttribute get DocString It would be good for future interpreters to see what something means. Thanking_You RIGHT_THEN" RIGHT_THEN 5 Active Tickets 24 Create a DLR backend Cobra Compiler 0.8.0 task new 2008-07-03T20:32:44Z 2008-07-03T20:32:44Z "Create a DLR-only backend for Cobra. This would be useful for embedding Cobra, for making an interpreted version of it, for making an interactive prompt (a la LISP and Python) and for exploring the pros and cons of DLR vs. CLR. There is an article at http://www.dotnetguru.org/us/dlrus/DLR2.htm on this topic. " Chuck 6 Active Tickets 246 warn on overwriting variable as a for loop's variable Cobra Compiler 0.8.0 enhancement new 2010-08-14T02:32:11Z 2010-08-14T02:32:11Z "This produces no warning: def f(i as int) for i in [0, 1] print i print i # it's 1, whoops! In C#, you'd get an error if you did ""for(int i = 0; ..."", so falling back on C# as a warning mechanism for this doesn't really work. I don't know whether other people do silly things like this more often than people want to make a for loop's variable have a wider scope than the loop itself. Just warning on using parameters in this way, rather than any variable, would have done the trick in the code that made me submit this ticket, and would probably lead to less false positives, if that's an issue. think that should be a warning? its not an issue in c# cause you don't have implicit variable declarations, so the ""let c# do the warnings"" strategy doesnt work" Kurper 6 Active Tickets 279 Warn about unused method's argument Cobra Compiler 0.8.0 enhancement Charles assigned 2011-05-31T16:16:24Z 2011-07-30T05:09:08Z "Detect unused method arguments within his body Define a new arg modifier that is allowing to declare unused parameter {{{ class Example def looks_like_a_mistake( param ) print 'Hello world ! i did not use provided argument' # must print a warning def looks_like_ok( param as unused String ) print 'Hello world ! i did not use provided argument' # is ok, as arg in declared unused def is_also_ok_as_abstract( ) is abstract # is ok as method this is an abstract method def passed_method_are_also_ok( ) pass # this is ok as there is only one statement, and this is a PassStmt }}} The warning should read: {{{ The value of parameter ""[param.name]"" is never used in [.parentBox.name].[.name]. #BackEndObjC/ObjcGenerator.cobra(247): warning: The value of parameter ""cw"" is never used in SomeClass.SomeMethod. }}} Concerning current patch - Provided patch does skip abstract method, empty method, pass'ed method, - They are some unexpected result when logging operations, i don't really know what it is for now {{{ : (empty)(1): warning: The value of parameter ""value"" is never used in IExpr.type.set. : (empty)(1): warning: The value of parameter ""value"" is never used in IExpr.receiverType.set. : (empty)(1): warning: The value of parameter ""value"" is never used in IExpr.contextType.set }}} - I found what looks like a false/positive in {{{ : Source/Cobra.Lang/CobraFrame.cobra(13): warning: The value of parameter ""args"" is never used in ['public'] CobraFrame.cue.init. }}} where code source is like this {{{ namespace Cobra.Lang class CobraFrame implements HasAppendNonPropertyKeyValues .... var _args as Object[] .... cue init(declClassName as String, methodName as String, fileName as String, lineNum as int, args as vari Object) """""" args should have the arg names embedded: ""x"", x, ""y"", y """""" .... _args = sharp'(object[])args.Clone()' .... get args from var #... }}} - For now there is 123 parameters detected as unused, they was 300 at beginning." maboiteaspam 6 Active Tickets 375 Confusing error message when omitting `as dynamic` Cobra Compiler 0.9.6 enhancement new 2014-07-26T16:16:09Z 2014-07-26T16:16:09Z "The following code {{{ class VoidError def doError(x) return x def main .doError(1) }}} produces the error {{{ error: Keyword ""void"" cannot be used in this context= }}} which appears to come straight from the C# compiler. Coming back from Python, I forgot to add {{{ as dynamic }}} to the method signature. Would it be possible to detect a return statement in a void method and either treat {{{ as dynamic }}} as implied, or raise a more suitable error message that pertains directly to the Cobra source?" Jonno 6 Active Tickets 135 misleading/non consistent warning message when assigning result of void returning method Cobra Compiler 0.8.0 task new 2009-01-13T22:16:14Z 2009-01-13T22:16:14Z "this program output different warnings if WillReturnVoid is defined in another assembly: {{{ class WillReturnVoid def returnVoid pass class Program shared def main foo = WillReturnVoid() bar = foo.returnVoid print ""void"" }}} within assembly: {{{ returnvoidvalueisnotassignable.cobra(9): error: There is no type for the left hand side of ""="". Use a different method or change that method to return something. returnvoidvalueisnotassignable.cobra(9): warning: The value of variable ""bar"" is never used. Compilation failed - 1 error, 1 warning Not running due to errors above. }}} another assembly: {{{ returnvoidvalueisnotassignable.cobra(5): warning: The value of variable ""bar"" is never used. c:\home\dev\tmp\cobratickets\returnvoid\returnvoidvalueisnotassignable.cobra(3): error: System.Void cannot be used from C# -- use typeof(void) to get the void type object. c:\home\dev\tmp\cobratickets\returnvoid\returnvoidvalueisnotassignable.cobra(5): error: Cannot implicitly convert type ""void"" to ""System.Void"" Compilation failed - 2 errors, 1 warning Not running due to errors above. }}} expected result: one consistent message: ""you can't assign the result of [methodName] from [methodOwnerType] to [assigneeExpr] because this method is defined to return void""" gauthier