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

Update JS to newest standard #307

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft

Update JS to newest standard #307

wants to merge 26 commits into from

Conversation

Ashvin-Ranjan
Copy link
Contributor

@Ashvin-Ranjan Ashvin-Ranjan commented Aug 28, 2022

Updating the JS branch to the newest standard, it will be labeled as v0.1.0 after this!

Things to add:

  • operators
    • XOR
    • Update not equal
    • >> and <<
      • >>> and <<< perhaps?
    • in
    • Indexing
    • Allow | to be used for defaulting
    • Allow ~ to indicate if a maybe is null
    • .. spread operator
      • spread with functions
  • loops
    • while
    • continue
    • break
    • Remove old for loop
  • else if
  • FileIO
    • writeBytes
    • appendBytes
    • readBytes
    • getFiles
    • Make all of the return types responses instead so that errors can be passed
    • Make relative to the file that calls it
  • SystemIO
    • sendSTDOUT
  • request
    • Combine all functions into one request.request
    • createServer
  • times
    • getTime
  • websocket
    • createServer
  • mutex
    • new
    • tryAccess
    • access
    • read
    • write
  • Functions
    • toFloat
    • printWithEnd
    • subsection
    • parallel
    • intoModule
    • getUnitTestResults
  • Update record syntax to use ,
  • Update enum syntax to be more similar to function syntax
  • Change function syntax
    • Change function type syntax
  • Add internal traits
    • Test all internal traits
  • Update var syntax
    • Allow indexing in var syntax
  • Add in new test/update old ones

@Ashvin-Ranjan
Copy link
Contributor Author

I have actually had a dilemma over whether the function type syntax needs to be changed.

For some background, when we originally decided to change the function type syntax @SheepTester was opposed to it, as the function syntax represents how functions actually are. In the python version this was harder to notice, but in the compiled JS code it is easy to see how something like:

sum(1, 2)

is actually compiled to [1]:

sum(1)(2)

So it seems better to have the function type be int -> int -> int vs (int, int) -> int as you are not really putting in a tuple, but calling the function one argument at a time.

Any thoughts on the matter would be appreciated.

[1]: Note that this is not the exact compiled code but just a simplified representation of how it goes down

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

Successfully merging this pull request may close these issues.

1 participant