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

If a grouped component has an underscore as a placeholder input then double clicking on it does not open the group #10281

Closed
AdRiley opened this issue Jun 13, 2024 · 5 comments
Labels

Comments

@AdRiley
Copy link
Member

AdRiley commented Jun 13, 2024

Image

@AdRiley AdRiley added p-high Should be completed in the next sprint --bug Type: bug -gui labels Jun 13, 2024
@AdRiley AdRiley added this to the Beta Release milestone Jun 13, 2024
@kazcw
Copy link
Contributor

kazcw commented Jun 13, 2024

This is a complex issue. If the component has an underscore placeholder, the component doesn't call the method--it just creates a function that will call the method if completed with the missing argument. Currently, we can only enter a called method. We could add support for entering the un-executed definition of a method, though we'd have less information from the backend in that state.

@AdRiley AdRiley modified the milestones: Beta Release, 2024-07 Release Jun 15, 2024
@farmaazon farmaazon added s-info-needed Status: more information needed from submitter x-on-hold and removed s-info-needed Status: more information needed from submitter labels Jun 27, 2024
@JaroslavTulach
Copy link
Member

JaroslavTulach commented Jun 27, 2024

The specification for underscore arguments is here and as far as I can tell, the current behavior is correct. The following Main.enso program assigns lambda function to variable node:

$ cat Main.enso 
from Standard.Base import all

foo a = a + 2

main =
    node = Main.foo _
    node

test with:

./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --run Main.enso
Main.main.node[Main.enso:6:12-21] <internal-0>=_

e.g. there is no invocation. If you want to invoke the function in node, change the last line to node 40, for example. This is different to

main =
     node = Main.foo
     node

where there is an attempt to partially invoke function foo - e.g. the IDE gets notification about the attempt and also information that argument a has not been supplied.

@farmaazon
Copy link
Contributor

For GUI, the only way to handle this would be implementing some sort of name resolution, which is duplicating work the engine is already doing, and still I'm not sure if we get all the needed information.

Alternatively, the engine could implement an eta conversion compiler step, to internally convert expressions like

node = bar a _

to

node = bar a

or more complex example

node = bar _ a fourthArg=b

becomes

node = bar secondArg=a fourthArg=b

Of course, handling also lambdas (a -> foo afoo) would be nice if not particularly harder.

@AdRiley @JaroslavTulach @jdunkerley so I'm reassigning it to Dmitry to be planned for engine, as the second solution is much better IMO.

@farmaazon
Copy link
Contributor

From Discord discussion

I did it using the code editor as I think that is how James first taught me.
Perhaps if we don't need the _ and the GUI doesn't generate one then this isn't an issue any more. We just need to make sure I stop adding underscores and don't teach anyone else that way.

So I guess this issue may have low priority

@farmaazon farmaazon added p-low Low priority and removed p-high Should be completed in the next sprint labels Jul 5, 2024
@JaroslavTulach
Copy link
Member

JaroslavTulach commented Jul 8, 2024

I did it using the code editor
So I guess this issue may have low priority

I'd even claim it is not a bug. Enso is Turing complete language and we cannot statically understand what the code does in 100% of cases. This one is an edge case, where we could improve, but the benefit seems small for now.

Perhaps ... don't teach anyone else (adding underscores)

Enough to Main.collapsed instead of Main.collapsed _.

@JaroslavTulach JaroslavTulach closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
@github-project-automation github-project-automation bot moved this from ❓New to 🟢 Accepted in Issues Board Jul 8, 2024
@AdRiley AdRiley removed this from the Future Release milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 🟢 Accepted
Development

No branches or pull requests

6 participants