ClojureScript

keywords should be implemented as JavaScript functions

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Keywords are currently implemented as JavaScript strings. This makes certain JavaScript interop situations awkward: to provide a javascript api a function that can pull data from a map, one must use #(:foo %) instead of the more natural :foo. This is confusing because ClojureScript functions are otherwise fully usable in contexts expecting JavaScript functions.

The proposed alternative is to have keywords instead be implemented as JavaScript functions that accept a map and optional default value, assuming this doesn't otherwise screw up their core functionality of providing fast equality tests, etc.

Activity

Hide
David Nolen added a comment -

Keywords & Symbols are likely to become a proper ClojureScript datatypes. The benefit of keywords & symbols as implemented as functions is small.

Show
David Nolen added a comment - Keywords & Symbols are likely to become a proper ClojureScript datatypes. The benefit of keywords & symbols as implemented as functions is small.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: