Re: [myhdl-list] Modules interface information
Brought to you by:
jandecaluwe
From: Christopher L. <loz...@fr...> - 2011-05-05 15:12:35
|
On 5/5/11 4:17 AM, Christopher Felton wrote: > > In traditional HDL you have a well-defined interface in the modules: In Zope 3, they solve this kind of problem by having both implementation files, and interface files. MyHDL already has implementation files. Obviously the interface files define the interfaces. Then two different classes can share the same interface. For example there may be two different implementations of a floating point multiplier, that share no code, but have the same interface. Or you may have two different implementations of an adder that have the same interface. You can read more here. http://wiki.zope.org/zope3/WhatAreInterfaces I will quote a small part of the page. Forget those explanations about patterns. And forget about Python classes. Interfaces are a Zope 3 /invention/ mainly to: 1. Allow the exposing of an API (every component has an external interface. 2. Allow the Zope 3 machinery to query the interface. Interfaces can set constraints - so when you access a /value/ they can throw an error allowing for strict(er) type checking. Interfaces can set constraints - so, for example, containers know what other interfaces can be contained. Key to understanding /interfaces/ is that they can be /queried/ and /constraints/ can be added. Quite simple, /really/. We should be able to just use their interface system without needing the rest of Zope 3. I think that the Zope 3 interfaces system is brilliant. My understanding is that in general it gets a lot of respect. Indeed it allows for appropriate type checking, in a dynamically typed language. Perfect. And it supports documentation. And does lots of other wonderful things in a Zope 3 environment. Presumably we will use it in other ways to simplify this application, much like decorators proved so useful. -- Regards Christopher Lozinski Check out my iPhone apps TextFaster and EmailFaster http://textfaster.com Expect a paradigm shift. http://MyHDL.org |