cucapra / cucapra/protocols

lang: two protocols with same name, defined over differents structs

Open
#248 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
15
Forks
0
Avg merge
6h 20m
Merged PRs (30d)
15

Description

We have some protocols that do the following:
```
#[idle]
prot idle() {
// ....
}

#[idle]
prot idle() {
// ...
}
```

This seems like a totally legitimate thing to do. However, it kind of violates some rules around duplicate names that one would expect from a programming language. Namely that you cannot have two functions in the same scope that are both named `idle`.

Maybe it is time to switch to more of a `impl` style protocol definition. Like:

```
impl ReadSubordinate {
#[idle]
prot idle(DUT: Self) {
// ....
}
}

impl WriteSubordinate{
#[idle]
prot idle(DUT: Self) {
// ....
}
}
```

I don't necessarily like the `DUT: Self`. Another option would be a magic `self` or even a magic `dut`.

Contributor guide

No contributing guide indexed for this repository

Research direction

No implementation file, test, or entry point is named. Start by locating the parser and name-resolution code for protocol definitions and the existing duplicate-name checks. Done means agreeing on the protocol syntax and defining how same-named protocols over different structs are represented and validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.