Hdl21 icon indicating copy to clipboard operation
Hdl21 copied to clipboard

"Failure to assign" error feedback

Open dan-fritchman opened this issue 1 year ago • 0 comments

Example:

@h.module 
class M:
  i = h.Input()
  o = h.Output()
  s = h.Signal()

There is a similar-looking, but not-working, alternative one might write like so:

@h.module 
class M:
  h.Input(name="i")
  h.Output(name="o")
  h.Signal(name="s")

That "works", in the sense that Python will compile and execute it. But it is highly unlikely to be what the author intended. In the latter case the hdl21.Module M is empty.

Note I do not think the latter should "work". It would be nice to produce some kinda error or feedback though.

But - either "working" or just producing the error would seem to require some tracking of execution context, which I don't love.
Maybe something better will come up.

dan-fritchman avatar Sep 07 '23 22:09 dan-fritchman