Skip to content

Renamed type 'channels' to 'channel'#19

Merged
lou1306 merged 3 commits intomasterfrom
issue15
Dec 11, 2024
Merged

Renamed type 'channels' to 'channel'#19
lou1306 merged 3 commits intomasterfrom
issue15

Conversation

@aaniculaesei
Copy link
Copy Markdown
Collaborator

@aaniculaesei aaniculaesei commented Dec 10, 2024

Writing enum channel {c, g1, g2,vmm1,vmm2, vmm3} creates a new type called channel which is an enum. However, we already have a predefined type called channel. This causes a name collision.

There are two alternatives, which can help us to avoid the name collision:

  1. Ditch the predefined type channel and define channel as an enumeration type as in enum channel {c, g1, g2,vmm1,vmm2, vmm3}
  2. Keep the predefined type channel and declare several variables of type channel, which will be used throughout an ReCiPe model to allow the agents to communicate with each other. This is done like this: channel c, g1, g2, vmm1, vmm2, vmm3

Since channels are important elements in an ReCiPe model, it makes sense to have a predefined type called channel. Therefore, I chose to implement the second alternative in the grammar.

@lou1306
Copy link
Copy Markdown
Contributor

lou1306 commented Dec 11, 2024

Thank you, Adina. I fixed some minor issues with the PR.

  • Somehow the grammar on this branch reverted to /\, \/ instead of forall, exists
  • The examples in the examples/error directory were still using the old syntax

By the way, some of those examples were also using other forms of syntax that we have since changed. We should strive to always keep them up-to-date, possibly by creating an automated test suite. I'll file a new issue about this.

@lou1306 lou1306 merged commit 96493bb into master Dec 11, 2024
@lou1306 lou1306 deleted the issue15 branch December 11, 2024 09:03
@lou1306
Copy link
Copy Markdown
Contributor

lou1306 commented Dec 11, 2024

By the way, those are not variables.

c, g1, g2, vmm1, vmm2, vmm3 are literals, not variables. The predefined type channel is still an enumeration, in the sense that actual variables of type channel may only assume one of these values.

Therefore I am a bit skeptical of the new syntax but if you have discussed it in the last meeting I can roll with it.

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

Successfully merging this pull request may close these issues.

2 participants