hkust-taco / mlscript

The MLscript programming language. Functional and object-oriented; structurally typed and sound; with powerful type inference. Soon to have full interop with TypeScript!
https://hkust-taco.github.io/mlscript
MIT License
175 stars 27 forks source link

Allow selecting tuple by integer indices #192

Closed chengluyu closed 1 year ago

chengluyu commented 1 year ago

Changes

Syntax

Tuple indices in selection should matches regular expression 0|[1-9][0-9]. Records and record types now accept non-negative integers as field names (e.g., { 1: "Hello" }).

Typing

JavaScript Code Generation

Tests

LPTK commented 1 year ago

Cool, thanks, but why on Earth would you update Parser and MLParser with that change? These are legacy parsers, and in particular we should get rid of Parser ASAP.

chengluyu commented 1 year ago

I have modified TupleType, so tests using the old parsers will also fail. So, I updated them as well.

LPTK commented 1 year ago

Why not mark the PR as "ready for review"?

chengluyu commented 1 year ago

Sorry, I forgot this time.

chengluyu commented 1 year ago

Thanks!