Clojure

make -> and ->> metadata-aware

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.1
  • Component/s: None
  • Labels:
    None
  • Approval:
    Ok

Description

Macros ></code> and <code>>> are currently hard to hint because metadata aren't preserved on lists.
Together with #205, it would allow to write:
(-> #^objects dd #^doubles (aget i) (aget j))
(instead of {{(let [#^doubles a (aget #^objects dd i)] (aget a j))}})

Activity

Hide
Assembla Importer added a comment -

cgrand said: [file:dVsuqiWaCr3PaHeJe5afGb]: patch

Show
Assembla Importer added a comment - cgrand said: [file:dVsuqiWaCr3PaHeJe5afGb]: patch
Hide
Assembla Importer added a comment -

meikelbrandmeyer said: Isn't it sufficient to hint inside the parens?

Clojure
user=> (set! *warn-on-reflection* true)
true
user=> (-> "foo" identity .length)
Reflection warning, NO_SOURCE_PATH:2 - reference to field length can't be resolved.
3
user=> (-> "foo" #^String identity .length)
3
user=> (-> "foo" #^String (identity) .length)
Reflection warning, NO_SOURCE_PATH:4 - reference to field length can't be resolved.
3
user=> (-> "foo" (#^String identity) .length)
3
Show
Assembla Importer added a comment - meikelbrandmeyer said: Isn't it sufficient to hint inside the parens?
Clojure
user=> (set! *warn-on-reflection* true)
true
user=> (-> "foo" identity .length)
Reflection warning, NO_SOURCE_PATH:2 - reference to field length can't be resolved.
3
user=> (-> "foo" #^String identity .length)
3
user=> (-> "foo" #^String (identity) .length)
Reflection warning, NO_SOURCE_PATH:4 - reference to field length can't be resolved.
3
user=> (-> "foo" (#^String identity) .length)
3
Hide
Assembla Importer added a comment -

cgrand said: The first time I had to hint a -> form, I found that hinting inside the parens wasn't obvious. It feels more regular to me like this
I should maybe rework #205 to also preserve tags on the first item of the list and make both ways (inside and outside) works with inlined and interop form.

Show
Assembla Importer added a comment - cgrand said: The first time I had to hint a -> form, I found that hinting inside the parens wasn't obvious. It feels more regular to me like this I should maybe rework #205 to also preserve tags on the first item of the list and make both ways (inside and outside) works with inlined and interop form.
Hide
Assembla Importer added a comment -

cgrand said: (In [[r:749a0ad8b66c781d8176833f0ad26cfe6b9b24e3]]) make -> and ->> metadata-aware Fixes #206

Signed-off-by: Chouser <chouser@n01se.net>

Branch: master

Show
Assembla Importer added a comment - cgrand said: (In [[r:749a0ad8b66c781d8176833f0ad26cfe6b9b24e3]]) make -> and ->> metadata-aware Fixes #206 Signed-off-by: Chouser <chouser@n01se.net> Branch: master

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: