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

Debugger doesn't show atom fields when there are multiple constructors #10675

Closed
2 tasks
Akirathan opened this issue Jul 25, 2024 · 9 comments · Fixed by #11217
Closed
2 tasks

Debugger doesn't show atom fields when there are multiple constructors #10675

Akirathan opened this issue Jul 25, 2024 · 9 comments · Fixed by #11217
Assignees
Labels
-compiler -tooling Category: tooling

Comments

@Akirathan
Copy link
Member

Akirathan commented Jul 25, 2024

From the InteropLibrary perspective, an Atom lists all field for all constructors as members. But it should list just fields for the constructor that was used to construct that atom.

The Atom members are, e.g., displayed as fields in the chrome inspector debugger. For the following atom:

type My_Type
  Cons_1 f1 f2
  Cons_2 g1 g2

main =
  My_Type.Cons_1 1 2

we would like to see only f1 and f2 fields, not any other.

An example of wrongly listed fields in the debugger:
image

All field accessors for all constructors are registered in AtomConstuctor.collectFieldAccessors.

Tasks

Related to:

@Akirathan Akirathan added the -tooling Category: tooling label Jul 25, 2024
@Akirathan Akirathan changed the title Atom members should list fields for one constructor Debugger doesn't show atom fields when there are multiple constructors Jul 25, 2024
@JaroslavTulach JaroslavTulach moved this from ❓New to 📤 Backlog in Issues Board Jul 26, 2024
@JaroslavTulach
Copy link
Member

It is annoying to see the fields of sibling Atoms in the debugger. The simplest fix is to not list them in InteropLibrary.getMembers as you suggest. How would the fix be related to

@Akirathan
Copy link
Member Author

How comes the functions aren't visible in the debugger? Does the debugger avoids displaying members that return true from isMemberInvocable?

@JaroslavTulach Because Atom.isMemberReadable only returns true for constructor fields. Debugger does not avoid members that are invocable - it normally displays them as functions.

How comes the Atom.getMembers messages only lists functions?

That seems like a historical inheritance. I have no idea. We should rethink the interop protocol for Atom. Let's consider the following snippet:

type My_Type
  Cons_1 f
  Cons_2 g
  instance_method self = 1
  static_method = 42
My_Type.extension_method self = 42

obj1 = My_Type.Cons_1 1
obj2 = My_Type.Cons_2 2

My proposition is:

  • Members of obj1 should be just f - that is, only fields of the corresponding constructor.
  • In similar way, only member of obj2 should be g.
  • Members of My_Type shall be [Cons_1, Cons_2, instance_method, static_method, extension_method], that is, all methods and all constructors for the type.

For convenience, we can introduce a special internal member of atom called, say, _type_ that refers to its type and one could expand it in the debugger and see all the methods on the type, similarly to how, e.g., JavaScript does that via its [[prototype]] internal member.

@JaroslavTulach
Copy link
Member

With 2024.3.1-nightly.2024.7.27 version I see in Chrome Dev Tools:

broken fields in chrome dev tools

E.g. neither f or g field is displayed.

@enso-bot
Copy link

enso-bot bot commented Oct 6, 2024

Pavel Marek reports a new STANDUP for today (2024-10-06):

Progress: - Changing and testing the polyglot interop contract for Atom to support the debugging properly. It should be finished by 2024-10-09.

@enso-bot
Copy link

enso-bot bot commented Oct 7, 2024

Pavel Marek reports a new STANDUP for today (2024-10-07):

Progress: - Helping with aws-wrapper project in #10714 and fixing AWS_Tests

  • Solving problems with module dependencies, service loaders, etc. It should be finished by 2024-10-09.

@enso-bot
Copy link

enso-bot bot commented Oct 8, 2024

Pavel Marek reports a new STANDUP for today (2024-10-08):

Progress: - Helping to fix more module-related issues in #10714.

  • Trying to get the atom interop contract to the state before this year's April.
    • Atom members are fields and methods
    • Fields and (public) methods are readable and invocable. It should be finished by 2024-10-09.

@JaroslavTulach
Copy link
Member

@enso-bot
Copy link

enso-bot bot commented Oct 14, 2024

Pavel Marek reports a new STANDUP for today (2024-10-14):

Progress: - Helping Hubert with modularization issues - #11323

@mergify mergify bot closed this as completed in #11217 Oct 15, 2024
@github-project-automation github-project-automation bot moved this from ⚙️ Design to 🟢 Accepted in Issues Board Oct 15, 2024
@JaroslavTulach
Copy link
Member

I can confirm that the debugging experience in VSCode and runEngineDistribution --debug is great and doesn't need any urgent improvements!

debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-compiler -tooling Category: tooling
Projects
Status: 🟢 Accepted
Development

Successfully merging a pull request may close this issue.

2 participants