Closed izaid closed 7 years ago
@shashi What do you think? Happy to merge this?
This seems like a special case. What about all the million other Tile
types which can well be converted to Elem
s?
I think you should keep this in an @require Escher begin ... end
inside ThreeJS or your application.
I think the deeper question here is do we need render
at all? (Why not have all Escher functions just return Elem
s?) I'm trying to come up with a way to get rid of render
, but it won't happen immediately.
Why do you need render at all right now? For intents and subscriptions?
Yes. More generally, for dispatch on Tile
types, for example, wrapbehavior
takes a ton of different Tile types and gives back Behavior tiles.
if we do away with render, we need to be able to parameterize Elem
s by arbitrary types so that this ability can be retained, (the terrible) Elem{ns, tag}
should really be Elem{T}
where T is anything for users of Patchwork to use.
This PR adds a single line to Escher.jl:
convert(::Type{Node}, sub::Subscription) = render(sub, Dict())
. That line allows aSubscription
to be used directly with<<
without a user having to callrender
on it directly.I'd argue that this is useful, as some subscriptions can already be used with
<<
-- seedropdownmenu
, for instance. My motivation here was to make subscriptions in other packages, like ThreeJS.jl, easier.This PR is ready for review / merging.