# Generic constructors

**URL:** https://talk.remobjects.com/t/generic-constructors/19456
**Category:** Elements Bugs
**Tags:** swift, silver, iodine, java
**Created:** [May 16, 2019, 12:35am UTC](https://talk.remobjects.com/t/generic-constructors/19456 "2019-05-16T00:35:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![dbroggi](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dbroggi](https://talk.remobjects.com/u/dbroggi)
#### Post date: [May 16, 2019, 12:35am UTC](https://talk.remobjects.com/t/generic-constructors/19456/1 "2019-05-16T00:35:45Z")

</div>

**IDE:** _Visual Studio X/Fire_  
**Version:** _10.0.0.2399 (develop)_  
**Target** (If relevant): _NET_  
**Description** :  
Swift allows generic initializers, therefore I would expect either the error to mention it’s being specific to Silver, or to allow it because Java allows generic constructors ([docs](https://docs.oracle.com/javase/specs/jls/se12/html/jls-8.html#jls-8.8.4)).

However, it would seem form a little testing that Elements does not support generic constructors in Iodine either. ([example source](https://codesjava.com/generics-constructor-in-java-example-tutorial))

**Expected Behavior** :  
“E: Generics not allowed here **in Silver** [\<file\> (\<line\>)]”  
Or, preferably:  
Compiles.  
**Actual Behavior** :  
(A) “E: Generics not allowed here [\<file\> (\<line\>)]”  
(B) “E: identifier expected, got opening parenthesis [\<file\> (\<line\>)]”  
**Steps** :  
Silver:

```auto
class S {
    init<T>(_ t: T) {} // Error A
}

```

Iodine:

```auto
class Test {
    public <T> Test(T item) { // Error B
       //
    }
}

```

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [May 16, 2019, 5:14am UTC](https://talk.remobjects.com/t/generic-constructors/19456/2 "2019-05-16T05:14:40Z")

</div>

Thanks, logged as [bugs://82615](https://www.remobjects.com/portal/bugs/?id=82615)

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [May 20, 2019, 6:51am UTC](https://talk.remobjects.com/t/generic-constructors/19456/3 "2019-05-20T06:51:06Z")

</div>

I’m going to solve the erroring (so it properly parses it) and log a separate research issue for actually supporting this feature in the future.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [May 20, 2019, 6:51am UTC](https://talk.remobjects.com/t/generic-constructors/19456/4 "2019-05-20T06:51:10Z")

</div>

Thanks, logged as [bugs://82634](https://www.remobjects.com/portal/bugs/?id=82634)

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [May 20, 2019, 6:59am UTC](https://talk.remobjects.com/t/generic-constructors/19456/5 "2019-05-20T06:59:26Z")

</div>

[bugs://82615](https://www.remobjects.com/portal/bugs/?id=82615) got closed with status fixed.
