Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question regarding type safety of generated code #7

Open
oco-adam opened this issue Jul 14, 2021 · 2 comments
Open

A question regarding type safety of generated code #7

oco-adam opened this issue Jul 14, 2021 · 2 comments

Comments

@oco-adam
Copy link

Hi @bamboo,

I'm new to Idris and was playing around with your code generator, seeing if it might be possible to generate dart library code:

I see that in the generated code, all generated dart types are dynamic, and in particular, primitive type information is lost. I was wondering if you could please explain why you implemented this way?

I realise that there will be many Idris types which cannot be canonically expressed in dart types, but for primitive types, might it be possible to map them to corresponding dart types? The aim would be to generate dart library code with more type information, so that e.g. the generated dart functions maintained some level of type safety.

This is probably more of a quest to try and understand things better myself rather than a feature request, however I would eventually be willing to help out if you thought this kind of thing would be possible/useful.

@bamboo
Copy link
Owner

bamboo commented Jul 14, 2021

Hi @oco-adam,

I see that in the generated code, all generated dart types are dynamic, and in particular, primitive type information is lost. I was wondering if you could please explain why you implemented this way?

It was the quickest mapping from the chosen untyped intermediate representation produced by Idris to Dart code but my goal is to produce better and more strongly typed Dart code. Towards that goal I'm currently investigating the idea of introducing a typed IR closer to Dart which would allow for a type reconstruction algorithm to be run before emitting the actual Dart code.

I would eventually be willing to help out if you thought this kind of thing would be possible/useful.

Yes, that would be great.

@aeiou-st
Copy link

primitive type information is lost

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

No branches or pull requests

3 participants