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

Are chunk types needed and what if we were to make them optional? #13

Open
draggett opened this issue Jun 27, 2020 · 0 comments
Open

Are chunk types needed and what if we were to make them optional? #13

draggett opened this issue Jun 27, 2020 · 0 comments

Comments

@draggett
Copy link
Member

Chunk types are useful for efficient indexing of chunks, and for better readability. Types are used in rule conditions and for some rule actions, e.g. to recall a matching chunk. For external actions, the type is just one piece of information to be passed to the action's implementation, and may be redundant, e.g. console is redundant in the following action as the implementation is selected using the name provided with @Do.

console {@do log; message "hello world"}

Making the type optional would introduce an ambiguity between the chunk type and the already optional chunk identifier. We could perhaps modify the syntax to remove the ambiguity, e.g. requiring a colon before the chunk identifier if it is present without the chunk type. e.g.

dog dog1 {name fido}
:p23 {name mia}
{name smokey}

But that feels rather awkward. Another idea would be to place the chunk type as a property, so that the example becomes:

dog1 {type dog; name fido}
p23 {name mia}
{name smokey}

That's better, but reduces readability compared to the existing syntax:

dog dog1 {name fido}
cat p23 {name mia}
cat {name smokey}

For now at least, I would recommend retaining the existing syntax where the chunk type is required, and can be replaced by an asterisk if it is unknown.

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

1 participant