I don't really understand HDL/Verilog, but I've worked with people who do. In fact, I even wrote a pre-processor that transformed the same DSL to Python, C++, and Verilog.
In my mind, the HDL use case is FAR too narrow and specialized to warrant a new arrow operator, let an entirely new parser and semantics around arbitrary operators. There are several existing dunders that could plausibly be repurposed already (<<, <<=, <=, etc). Those might look sightly different than the verilog operators, but that's a very small price. In fact, just using attributes and assignment is an incredibly low bar too, and allows whatever overriding you wish.
I just don't buy the idea that such a DSL can only be useful if it spells 'abc <== message' and useless if it spelled the same thing as 'abc <<= message'.
On Fri, May 24, 2019, 9:06 AM Yanghao Hua email@example.com wrote:
On Fri, May 24, 2019 at 12:29 PM Greg Ewing firstname.lastname@example.org wrote: >
Yanghao Hua wrote:
I have explained the problem of use descriptors in previous replies, where you cannot have a local signal, e.g. obj.signal = thing # works, but local_signal = thing # doesn't work.
Maybe you could do something like:
local = Signals() local.signal1 = ... local.signal2 = ...
In structure design ... and especially when you design a hardware that is meant to be automatically converted into verilog or even logic gates, I personally would really want to have a one-to-one relationship of the python-objects vs the actual hardware structures. The granularity is at signal/bit level. This is why I really think giving a special assignment in python which users could override is really helpful, rather than having to have this kind of special case: if you do "self.abc = thing" descriptor mechanism is invoked, but the very next line if you do "abc = thing" ... nothing will happen. This special case can be completely removed and having a much better conceptual consistency if the "<==" assignment operator always behaves the same, doesn't matter if it is "self.abc <== thing" or "abc <== thing".
Python-ideas mailing list Pythonemail@example.com https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/