-
Notifications
You must be signed in to change notification settings - Fork 9
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
Filament Import Redesign #342
Comments
@sampsyo might enjoy thinking about this; especially the |
Related to #118 |
During our meeting yesterday, we discussed the whole importing thing and came up with a couple ideas. We want to have some form of module system to prevent naming collisions and the like. We will likely have something like Currently, we have agreed that we don't want nested modules. This means that we don't want to allow a user to define a We also discussed the
@rachitnigam LMK if i'm missing anything else! |
My notebook #158 (comment) has a bunch of ideas as well, but here is a slightly more formalized version of that.
Current Syntax
Imports
can pollute parent namespace. #333Imports currently work with the following syntax:
and work similarly to Verilog's
`include
macro: adding every component offile.fil
to the namespace (recursing in a BFS fashion).This isn't ideal for a couple reasons:
path/to/file.txt
andpath/to/file.sv
are all possible - which is generally unnecessary and adds bulk to the syntax.New Syntax
Why
::
?Existential parameters already use the
::
syntax, and I personally see them somewhat similar to rusts'sTrait
s - where you can describe some attribute of a component without explicitly providing it. Therefore, it seems fitting to use::
(as rust does) for file imports and paths as well.Overriding components?
This is very speculative, as this is quite an odd feature and isn't super necessary, but if we want to keep the same overriding syntax as before I have a couple ideas.
First, we should discuss behavior. When overwriting a component, we should do so only at that import instance. For example, if we do
b
should still be able to properly usea::Comp
instead of the overwritten version.Why? Prevents cascading errors - we shouldn't be breaking behavior of other libraries with an override.
override
AttributePros and Cons
overrides
section to nodes in the file graph.Variant -
override(name)
We could instead tag components with
override(a::Comp)
instead, and allow the component name below to be anything. This would allow for behavior like#[override(a::Comp),override(b::Comp)
where we could overwrite multiple components at once (not sure why, but might be necessary).Variant -
overrideable
andoverride
We can also specify an
#[overrideable]
attribute that specifies a component as able to be overwritten, which allows for better safety in terms of not allowing users to overwrite any components they want.impl
andabstract
componentsIn
file.fil
:In the main file
Pros and Cons
extern
components somewhat.Personally I'm leaning toward the first implementation, due to the simplicity of implementation and how clear it is.
The text was updated successfully, but these errors were encountered: