-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
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.- Futures start being computed in
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 theobject-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.- Considering the above, we need a better way to handle attribute options. Nyxt uses position 3 and 4 in the declaration for width calculation and styling. It should be stored in the new
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. Example
(defmethod prompter:object-attributes ((buffer buffer) (source prompter:source))
(declare (ignore source))
`(("URL" ,(render-url (url buffer)) :html "..." :width 3)
("Title" ,(title buffer) :width 2)
("ID" ,(id buffer))))
would return an attribute
object with slot options
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.
Metadata
Metadata
Assignees
Labels
No labels