Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Add support for array types #22

Open
pbardea opened this issue Nov 10, 2017 · 5 comments
Open

Add support for array types #22

pbardea opened this issue Nov 10, 2017 · 5 comments

Comments

@pbardea
Copy link
Member

pbardea commented Nov 10, 2017

Array types need to support arrays of basic types as well as arrays of arrays.

@davepagurek
Copy link
Member

I guess instead of an enum for type, we need to do something like:

type Type = 'void' | 'bool' | 'int' | 'float' | Array<T extends Type>;

class Array<T extends Type> {
  // ...
}

Not sure if that even compiles though due to the recursive nature of that definition...

@davepagurek
Copy link
Member

OR maybe:

interface Type {
  string source();
}
type BasicType = Void | Bool | Int | Float; // etc
class Array <T extends BasicType> {
  // ...
}
type Type = BasicType | Array<T>;

@pbardea
Copy link
Member Author

pbardea commented Nov 10, 2017

I'm liking the second way... reading more about TypeScripts type system since I'm fairly new to what it has to offer.

@abhimadan
Copy link
Member

FWIW, we can only support multidimensional arrays with the first way, though that would be easier to support if we create a CFG for recognizing valid types.

@davepagurek
Copy link
Member

Ah good point. Maybe a good first step is seeing if typescript types can be recursive like that

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants