ClojureScript

new macro cljs.core/extend-instance

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test

Description

Patch introduces an extend-instance macro, similar to extend-type.
It doesn't extend the .prototype property, but assigns the prototype impl members to the instance itself.

This is useful to let existing instances, e.g. parsed JSON directly implement a protocol.

Activity

Hide
David Nolen added a comment -

Rich Hickey already had a good name for an operation like this - specify.

Show
David Nolen added a comment - Rich Hickey already had a good name for an operation like this - specify.
Hide
Herwig Hochleitner added a comment -

OK, I've declined the ticket, since not only the name but also the patches should be disregarded.

The problem with above impl is that the generated implementing fns get instantiated, every time extend-instance is evaluated. That is not acceptable on a per-instance basis.

I will work on a new macro called specify, which allows passing implementing fns.

Is a syntax similar to clojure.core/extend right for specify?
Should I create a new ticket?

Show
Herwig Hochleitner added a comment - OK, I've declined the ticket, since not only the name but also the patches should be disregarded. The problem with above impl is that the generated implementing fns get instantiated, every time extend-instance is evaluated. That is not acceptable on a per-instance basis. I will work on a new macro called specify, which allows passing implementing fns. Is a syntax similar to clojure.core/extend right for specify? Should I create a new ticket?
Hide
David Nolen added a comment -

As far as I understand it the interface for specify should be the same as extend-type.

Show
David Nolen added a comment - As far as I understand it the interface for specify should be the same as extend-type.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: