Fork me on GitHub
#clojure
<
2021-12-29
>
Ian Fernandez04:12:36

Help with sente, I need to force a receival of a message in a channel before the channel closes / webserver turns off. I'm using gniazdo for websocket client

Ian Fernandez21:12:41

There's no way to make a blocking call to a sente socket or something like this?

hiredman04:12:48

Forcing another computer on a network to do anything is a tall order

😂 1
😢 1
cap10morgan17:12:20

Anyone know why I'm getting Must hint overloaded method: get when I try to load this code (`TemporalAccessor` is from java.time.temporal)? Doesn't seem like there's anything else to hint...

(defrecord DefaultingDateTime [^TemporalAccessor date-time
                               ^TemporalAccessor default]
  TemporalAccessor
  (^int get [_this ^TemporalField field] (or (^int .get date-time field)
                                             (^int .get default field)))
  (getLong [_this field] (or (.getLong date-time field)
                             (.getLong default field)))
  (isSupported [_this field] (or (.isSupported date-time field)
                                 (.isSupported default field)))
  (query [_this query] (or (.query date-time query)
                           (.query default query)))
  (range [_this field] (or (.range date-time field)
                           (.range default field))))

seancorfield17:12:25

I don't think (^int .get date-time field) is valid, is it?

cap10morgan17:12:08

it might not be, it was an attempt to Hint All The Things! 😆 and didn't affect the error I was getting on load

seancorfield17:12:24

get is a default method on the TemporalAccessor interface -- I wonder if that's throwing Clojure's reflection off? Otherwise, it does seem you have everything hinted.

cap10morgan17:12:51

yeah I wondered about that too

cap10morgan17:12:37

I suppose I could work up a minimal test case for that to see if it's a bug

ghadi17:12:00

It's not a bug. A method named get is also automatically provided by one of the interfaces that defrecords automatically implement

1
cap10morgan17:12:04

@U050ECB92 ah, that makes sense. I wondered if it was related to how generic and common get is as a method name. so... no workaround then?

cap10morgan17:12:20

perhaps not using a record

cap10morgan18:12:47

yeah, just using reify fixes it. thanks again @U050ECB92!

phill00:12:59

In this case, the message did not hit the nail on the head. Hints were not the problem; a collision was the problem. Would it be feasible for the message to juxtapose the two(+) things that were not distinct? e.g., Associative/get and TemporalAccessor/get? I do not see this "Must hint..." message in the Clojure Jira. If I am barking up the right tree, would an enhancement suggestion to clarify the message be well received?

👍 1