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

Autoscoping of constructors #8645

Closed
JaroslavTulach opened this issue Dec 29, 2023 · 10 comments · Fixed by #9190
Closed

Autoscoping of constructors #8645

JaroslavTulach opened this issue Dec 29, 2023 · 10 comments · Fixed by #9190
Assignees

Comments

@JaroslavTulach
Copy link
Member

JaroslavTulach commented Dec 29, 2023

The goal of this task is to avoid:

table.aggregate Aggregate_Column.Count

and just write

table.aggregate Count

e.g. eliminate the need to prefix each constructor name with its type name when it is known from the context.

Join the discussion!

@JaroslavTulach
Copy link
Member Author

There are multiple ways to approach the problem. One of them is

Using UnresolvedSymbol

The idea is to use already existing UnresolvedSymbol to identify constructor of a type. When a certain type is requested by type ascription, the UnresolvedSymbol would know its context and resolve itself properly. For example following program could work:

from Standard.Base import all

type X
    A
    B x

cons x:X = x.to_text

main = cons .A

and yes, the program properly prints A with this experimental branch.

Pros
  • reuses already existing syntax
  • doesn't require changes in the parser
Cons

While the changes in 23bc507 are simple, alas they don't work for constructors with parameters. Writing main = cons .B 3 yields:

Type error: expected `x` to be X, but got X.B[x.enso:5:5-7] x=_. Try to apply x argument.

Obviously as .B is the argument of cons. However trying to workaround it with main = cons (.B 3) doesn't work either as:

Method `B` of type Integer could not be found.

Looks like reusing existing syntax has its downside - as in the .B 3 case we'd like different behavior than the current behavior is.

@enso-bot
Copy link

enso-bot bot commented Feb 26, 2024

Jaroslav Tulach reports a new STANDUP for the last Saturday (2024-02-24):

Progress: - Custom classloading for GraalVM EE Isolate

Next Day: Autoscoping of constructors

@JaroslavTulach JaroslavTulach moved this from ⚙️ Design to 👁️ Code review in Issues Board Feb 26, 2024
@enso-bot
Copy link

enso-bot bot commented Feb 27, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-02-26):

Progress: - autoscoped constructors: #9190

Next Day: Autoscoping of constructors

@enso-bot
Copy link

enso-bot bot commented Feb 28, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-02-27):

Progress: - Addressing Radek's comments: #9190 (comment)

Next Day: Autoscoping of constructors

GitHub
Do you remember how ugly it is to always prefix a constructor of a type with its type name? Always write something like: table.aggregate Aggregate_Column.Count Enso should do better! Let's discuss ...

@enso-bot
Copy link

enso-bot bot commented Feb 29, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-02-28):

Progress: - discussing autoscoped constructors with Marcin

Next Day: Speed autoscoping of constructors up

Meetup
Not a Meetup member yet? Log in and find groups that host online or in person events and meet people in your local community who share your interests.

@enso-bot
Copy link

enso-bot bot commented Feb 29, 2024

Jaroslav Tulach reports a new STANDUP for today (2024-02-29):

Progress: - benchmarks label idea: https://discord.com/channels/401396655599124480/1212626875902328842

Next Day: Finalize autoscoping of constructors

Discord
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Discord
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
GitHub
Do you remember how ugly it is to always prefix a constructor of a type with its type name? Always write something like: table.aggregate Aggregate_Column.Count Enso should do better! Let's discuss ...

@enso-bot
Copy link

enso-bot bot commented Mar 2, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-03-01):

Progress: - polishing autoscoped constructors PR

Next Day: Document and integrate autoscoped constructors

@enso-bot
Copy link

enso-bot bot commented Mar 4, 2024

Jaroslav Tulach reports a new STANDUP for the last Saturday (2024-03-02):

Progress: - documentation: 463e33f It should be finished by 2024-03-04.

Next Day: Document and integrate autoscoped constructors

@mergify mergify bot closed this as completed in #9190 Mar 4, 2024
mergify bot pushed a commit that referenced this issue Mar 4, 2024
Fixes #8645 by recognizing `~` prefix to constructor names.
@github-project-automation github-project-automation bot moved this from 👁️ Code review to 🟢 Accepted in Issues Board Mar 4, 2024
@JaroslavTulach
Copy link
Member Author

We are in. Dmitry reported

as a followup issue to make static dropdowns work in the IDE.

@enso-bot
Copy link

enso-bot bot commented Mar 5, 2024

Jaroslav Tulach reports a new STANDUP for yesterday (2024-03-04):

Progress: - autoscoped constructors merged: #9190

Next Day: Rewrite autoscoped constructors

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

Successfully merging a pull request may close this issue.

1 participant