-
Notifications
You must be signed in to change notification settings - Fork 1
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
Polish attributes API #21
Comments
Agreed!
To allow even lazier evaluation and getting attribute values only when these are required? I don't see the immediate benefit, but that sounds good.
Ad-hoc lists are so easy to work with 😞 But yeah, you're right here.
Yes!
If I got you right, you're suggesting returning a single
This way we have both
I don't remember why I did, but right now I'm on the side of having more structure 😅 |
Oh yes! That makes total sense, I can't see why I didn't think of subclassing, I guess my nose was still stuck to the list-based API! :p |
Follow up to #16. See #16 (comment).
The attributes API suffers from bit rot.
What needs to be tweaked:
attributes-default
,attributes-keys-default
and friends are poorly named, because they sound like they return the "default" of the attribute (which makes no sense), while it's the default attribute that's returned. Better names would bedefault-attribute
, etc.object-attributes
. Can we defer to later? Can we add an option to choose when to compute it?object-attributes
should return attribute objects instead of the ad-hoc lists.We've used list because of how attributes are declared in the
object-attributes
methods, but really there is no need to keep lists, we can very well use lists to declare opaqueattribute
objects, which then would have a proper API and which upstream would not destructure manually.attribute
object, but where? In a plist / hash-table? We need a way to refer to these options in a non-conflicting way: let's keep in mind that other libraries may have options with the same naming but different value. So we could index by package-prefixed symbols. Examplewould return an
attribute
object with slotoptions
set to((nyxt:html "...") (nyxt:width 3))
, or something like that.@aartaka What do you think? I remember you arguing in favour of positional options.
The text was updated successfully, but these errors were encountered: