Fork me on GitHub
#beginners
<
2016-05-16
>
nicorikken17:05:15

Relative beginner here, is there any way I can add metadata to a Java object? (a JRuby instance to be exact) I’d like to make sure that when I reuse the object (for parsing text in this case), I’m sure it has been loaded with the right properties and so is suitable for reuse. I tried using a ref to attach meta, but that doesn’t seem to work.

noisesmith17:05:14

nicorikken: only if it implements the IMeta interface

noisesmith17:05:23

refs do not implement IMeta, so they don't help there

noisesmith17:05:18

oh weird - they claim to implement IMeta, but I can't seem to attach or retrieve metadata...

whistlerbrk18:05:26

a bit strange how Clojure implements multiple dispatch, defmulti, is there an alternate syntax which does it in a single expression? like the let syntax?

alexmiller19:05:29

It's implemented that way to be open for later extension

alexmiller19:05:11

It's not too hard to get what you want in a macro though and I know I've seen impls in the past but can't remember where

whistlerbrk20:05:36

ah ha, that makes sense

whistlerbrk20:05:03

what doesn’t make sense it atom’s crazy automatic indentation when pasting Clojure code examples into the editor 😞

whistlerbrk20:05:13

on a completely unrelated note