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

implicit receiver syntax & supporting changes #766

Open
5 tasks
nikodemus opened this issue Jul 17, 2021 · 0 comments
Open
5 tasks

implicit receiver syntax & supporting changes #766

nikodemus opened this issue Jul 17, 2021 · 0 comments
Labels
design Design questions and issues feature-lang Language or library feature syntax Syntax change or addition
Milestone

Comments

@nikodemus
Copy link
Owner

nikodemus commented Jul 17, 2021

  • Unary methods with implicit receiver indistinguishable from variable accesses. (Variable and slot lookups could be considered unary sends to the lexical environment, but this semantic distinction need not be made now.)
  • Keyword methods allow function-like methods to be defined outside classes at module level.
  • Implicit receiver always resolved lexically: local environment, current class, current module.

Supporting changes:

  • assignment uses := instead of =. Needed to disambiguate one-element records from blocks with an assignment.
  • records use = instead of keyword syntax: { foo = 42, bar = 123 }. Need to disambiguate one-element records from blocks with an implicit receiver keyword send.
  • balanced delimiters around method bodies: needed to disambiguate first expression like foo: bar from additional method keywords.
  • defining methods at toplevel of module: method sin: angle ...
  • importing module and direct methods: import #sin: from lib.math
@nikodemus nikodemus added feature-lang Language or library feature design Design questions and issues syntax Syntax change or addition labels Jul 17, 2021
@nikodemus nikodemus added this to the Foolang 0.3.0 milestone Jul 17, 2021
@nikodemus nikodemus removed the design Design questions and issues label Jul 17, 2021
@nikodemus nikodemus added the design Design questions and issues label Jul 29, 2021
@nikodemus nikodemus modified the milestones: 0.3: optimizations, Later Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design questions and issues feature-lang Language or library feature syntax Syntax change or addition
Projects
None yet
Development

No branches or pull requests

1 participant