Clojure

Enable refering to ->type inside deftype

Details

  • Type: Enhancement Enhancement
  • Status: Open Open
  • Priority: Trivial Trivial
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Triaged

Description

Inside a defrecord body it's possible to refer to ->type-ctor but that is not possible inside deftype.

This patch adds an implicit declare, as done in defrecord making it possible to use the ->type-ctor inside deftype methods

Activity

Hide
Timothy Baldridge added a comment -

Seems valid. Vetting.

Show
Timothy Baldridge added a comment - Seems valid. Vetting.
Hide
Sam Estep added a comment -

Will this be incorporated soon? It's awkward to have to explicitly declare the factory function when defining, e.g., data structures (example). Also, the current situation violates the principle of least astonishment; while working through this tutorial, I was quite surprised to find that defrecord does implicitly declare the factory functions, which contradicted my prior experience with deftype.

Show
Sam Estep added a comment - Will this be incorporated soon? It's awkward to have to explicitly declare the factory function when defining, e.g., data structures (example). Also, the current situation violates the principle of least astonishment; while working through this tutorial, I was quite surprised to find that defrecord does implicitly declare the factory functions, which contradicted my prior experience with deftype.
Hide
Alex Miller added a comment -

No enhancements are considered critical so it's hard for me to say when this will get evaluated. I've bumped it one step down the process at least.

Show
Alex Miller added a comment - No enhancements are considered critical so it's hard for me to say when this will get evaluated. I've bumped it one step down the process at least.
Hide
Sam Estep added a comment -

Thank you, Alex! I completely understand that this isn't a particularly important issue; nonetheless, it is encouraging to see it move closer to being fixed.

Show
Sam Estep added a comment - Thank you, Alex! I completely understand that this isn't a particularly important issue; nonetheless, it is encouraging to see it move closer to being fixed.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: