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

Add example of chunk without identifier in section 4.2 #22

Open
tidoust opened this issue Nov 13, 2020 · 3 comments
Open

Add example of chunk without identifier in section 4.2 #22

tidoust opened this issue Nov 13, 2020 · 3 comments

Comments

@tidoust
Copy link
Member

tidoust commented Nov 13, 2020

See related comment from @ngcharithperera::

 (3) In Section 4.2, you mentioned that identifier is optional. Is it possible to give an example to show how it looks like?

@draggett replied that:

The spec should further say something to the effect that the chunk ID is optional, and if missing, will be automatically assigned when adding the chunk to a graph. If the graph already has a chunk with the same ID, it will be replaced by this one.

Re. automatically assigning an identifier, where would that info be exposed? That is, if someone loads a chunk that was defined without identifier in a module buffer, will they see the automatically assigned identifier? If they don't, why mention it?

@draggett
Copy link
Member

draggett commented Nov 13, 2020

Re. automatically assigning an identifier, where would that info be exposed?

Yes, the identifier is accessible via the scripting API after the chunk is added to the module's graph, and would be visible when outputting the graph to a text string.

@tidoust
Copy link
Member Author

tidoust commented Nov 16, 2020

Yes, the identifier is accessible via the scripting API after the chunk is added to the module's graph, and would be visible when outputting the graph to a text string.

The scripting API is out of scope of the initial document. Custom operations that could be used to serialize chunks are out of scope too (also, the serialization of the graph to a text string could omit identifiers that have been automatically assigned. After all, they did not exist in the initial graph, why would serialization return them?).

I'm more wondering whether an application can bind the automatically assigned identifier to a variable through @id and then re-use it later on.

@draggett
Copy link
Member

I'm more wondering whether an application can bind the automatically assigned identifier to a variable through @id and then re-use it later on.

Yes that should indeed work as the variable will bind to the chunk's ID which is automatically generated when the chunk is added to a module if it doesn't already have one.

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

No branches or pull requests

2 participants