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

operators are not documented #605

Open
ThinkOpenly opened this issue Jun 24, 2024 · 1 comment
Open

operators are not documented #605

ThinkOpenly opened this issue Jun 24, 2024 · 1 comment
Assignees

Comments

@ThinkOpenly
Copy link
Contributor

Section "Operators" lists 15 built-in operators in a precedence table, but not their function. These should be documented, even if well known to practitioners in the art of programming.

In addition, the String type is given pretty short shrift:

CAUTION: Sail is not a language designed for working with strings, and the semantics of ISA specifications should not depend on any logic involving strings. If you find yourself using strings for reasons other than printing or logging errors in a Sail specification, you should probably reconsider.

(Should that text be maintained?)

However, there is at least one operator for strings which isn't even mentioned: ^ for concatenation. Or is that not in Sail proper? Or not yet? 0.18?

@Alasdair
Copy link
Collaborator

Strings don't work well in the SMT and SystemVerilog translations, which is why we want to discourage their use.

Ideally we would have a static analysis that checks that no logic involving strings ever influences control flow. Also making things 'stringly-typed' (as per this blog post: https://www.hanselman.com/blog/stringly-typed-vs-strongly-typed) when an enum/union would be a better choice is a common beginner mistake.

The string support in the library is super bare-bones, so I think the operator is defined by the RISC-V specification.

@Alasdair Alasdair self-assigned this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants