Generic constructor with parameters fails to compile


(Mark Currie) #1

The commented out line fails to compile. This bug has been in Silver for a while now.

(RemObjects) #2

Thanks, logged as bugs://81441

(RemObjects) #3

bugs://81441 got closed with status fixed.

(Carlo Kok) #4


I’ve fixed the error (Unknown identifier T) but on .NET you can only instantiate T with zero parameters. (this is a platform limitation). So your workaround is probably the best way to go about it still.

(Mark Currie) #5

Hey Carlo, it was already working if there were no parameters, even in old builds. :slight_smile:

It’s too bad you cannot have your Silver compiler automatically generate the workaround code. When you say “this is a platform limitation” I assume there’s a good reason for you not to implement this now. But think about doing this later. A little polish goes a long way. Thanks.

(Carlo Kok) #6

Agreed. I’ll log an issue for future consideration.

(RemObjects) #7

Thanks, logged as bugs://81452

(Mark Currie) #8

Thank you Carlo. Good support for constructors is especially important in Swift especially because Swift pushes you to initialize all your non-optional variables in constructors. Cheers.