Comments (18)
@kevinbarabash Yes, the plan is to eventually support arbitrary computations in types (in a way that cleanly generalizes TypeScript's various ad-hoc type computation syntaxes). However, there is a long road before we get there, as for the moment we are busy working out the basic components of the language and type system.
from mlscript.
TODO:
- Generate MLscript declarations in new syntax for classes
- Generate correct namespace structure by extending namespaces in
NewParser.scala
from mlscript.
Is it from .ts
to .mls
, or .d.ts
to .mls
?
from mlscript.
I think it should work with both. Right?
from mlscript.
I think so. I can add some .d.ts
tests later.
from mlscript.
- Generate type alias declaration
from mlscript.
All interfaces are from TypeScript types.ts
from mlscript.
- Add
private
/protected
class A {
private a: number
protected b: string
}
from mlscript.
- deal with
export
in ts
Example:
export namespace N1 {
interface IF {
foo()
}
class Base {
a: number = 10
}
export class MyClass extends Base implements IF {
foo() {}
}
}
In this case, Base
will not be exported so users can't access to it. However, we still need to consider that MyClass
extends the Base
so we need to add a: number
into MyClass
from mlscript.
- deal with
export
in tsExample:
export namespace N1 { interface IF { foo() } class Base { a: number = 10 } export class MyClass extends Base implements IF { foo() {} } }In this case,
Base
will not be exported so users can't access to it. However, we still need to consider thatMyClass
extends theBase
so we need to adda: number
intoMyClass
Also we can create an instance by calling the exported function, but we can't use new
:
export namespace N1 {
class Foo {
a: number = 10
}
export function get(): Foo {
return new Foo();
}
}
let x = N1.get()
console.log(x.a)
// error!
// let y = new N1.Foo()
from mlscript.
- Fix such situation:
const none: Option<never> = { _tag: 'None' }
const some = <A>(a: A): Option<A> => ({ _tag: 'Some', value: a })
from mlscript.
Interesting. What's the return type of N1.get()
when viewed from the outside of this module/file? If it's something like N1.Foo
, then that means we should still export the class, but simply make its constructor private.
from mlscript.
Interesting. What's the return type of
N1.get()
when viewed from the outside of this module/file? If it's something likeN1.Foo
, then that means we should still export the class, but simply make its constructor private.
The type I got is:
symbol: <ref *1> SymbolObject {
flags: 32,
escapedName: 'Foo',
declarations: [Array],
exports: [Map],
members: [Map],
valueDeclaration: [NodeObject],
parent: undefined,
isReferenced: 788968,
id: 14
},
In the members, we can also get private/protected members.
So I think we do need a private constructor. 🤔
from mlscript.
I also find something like this in https://github.com/gcanti/fp-ts/blob/master/src/Option.ts.
export const URI = 'Option'
I think we'd better convert all stuffs rather than merely functions or interfaces.
from mlscript.
Huh, well yeah of course we should convert these too...
from mlscript.
(Note that the URI machinery is for higher kinded types and is used in conditional types, which we don't yet support.)
from mlscript.
- Add
readonly
support(mut
in MLScript)
from mlscript.
Are you planning to support mapped types, conditional types, etc.?
from mlscript.
Related Issues (20)
- Simplify the `with` construct semantics
- Implement new MLscript syntax
- Traits should be implemented as proper mixins
- The next step of code generation
- Add comprehensive contribution guide
- Add documentation to the MLscript code base
- Type errors in class definitions are swallowed in the web demo
- Add support for class type difference HOT 1
- UCS tracking issue HOT 7
- Add enumerated types (not ADTs)
- Iron out semantics of new object definition parameters and fields HOT 3
- Implement virtuality and constructor restrictions HOT 1
- User-defined operators can lead to insufficient fuel and constraint leakage HOT 3
- Potential infinite loop in type checking HOT 3
- Constructors can be called with invalid parameters HOT 1
- Wrong mixin typing
- Some generic object types are not lattice homomorphisms and those which are should not be forall-distributivity targets
- Infinite loop in expanding abstract class with self type HOT 4
- Quasiquote syntax support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlscript.