Replies: 4 comments 10 replies
-
It might also be nice to implement (doc-of ) for other types as well, it'd make it awesome for learning, if you can expect to be able to |
Beta Was this translation helpful? Give feedback.
-
Via Not sure how doc-of would work - and I there is not reason I think for a new function, There is already |
Beta Was this translation helpful? Give feedback.
-
On latest master, added an implementation of |
Beta Was this translation helpful? Give feedback.
-
Hey @bakpakin I assumed the reason for :next method in abstract types was to allow someone to build an iterable abstract type. Like say I want to create (btree/new ....) I really don't want :next then to be the methods of the abstract type. It should be the records in the b-tree, in order. If a convention of finding the methods of an abstract type is using (next) then we have a situation where my hypothetical b-tree will confuse people. And really it shouldn't. The way to find the methods of something should rather be something like (each (type-of (btree/new...) ... |
Beta Was this translation helpful? Give feedback.
-
When dealing with JANET_ABSTRACT types at the REPL, there isn't an easy way get a notion of what sorts of things one can do with them.
Right now JANET_ABSTRACT types expose a
Get()
function pointer at the C level, that janet uses to translate method calls to them. But it's not easy/possible to get a list of the valid keys forGet()
.One thing that would also be nice, in addition to getting a list of valid keys, would be setting aside one of those keys to get documentation from the object. For performance, I think it would make sense to not store the docs themselves on the object, but stash them away in a C constant, but it'd be nice to be able to have access to. Maybe via
(doc-of )
, that works by polling that key?Beta Was this translation helpful? Give feedback.
All reactions