This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-30
Channels
- # admin-announcements (10)
- # beginners (17)
- # boot (14)
- # braveandtrue (4)
- # cider (6)
- # cljsrn (38)
- # clojure (232)
- # clojure-austin (1)
- # clojure-belgium (2)
- # clojure-dev (20)
- # clojure-greece (20)
- # clojure-japan (3)
- # clojure-poland (39)
- # clojure-russia (76)
- # clojure-sanfrancisco (6)
- # clojure-uk (4)
- # clojurescript (90)
- # cursive (2)
- # data-science (10)
- # datomic (18)
- # garden (16)
- # hoplon (244)
- # immutant (3)
- # jobs (6)
- # jobs-discuss (2)
- # juxt (1)
- # off-topic (3)
- # om (50)
- # onyx (23)
- # re-frame (5)
- # reagent (36)
- # remote-jobs (11)
- # slack-help (6)
- # spacemacs (2)
- # untangled (46)
What is the correct way to convert strings to numbers and back?
read-string
(or clojure.edn/read-string
if you can't trust the data), or using one of the parse
methods of Long
or Double
urbanslug: this is not part of the official semantics because logic that relies on peek being helpful is likely to deadlock or hit race conditions
urbanslug: the operations provided are carefully crafted to avoid the pitfalls of concurrency
that said, there's probably some evil way to do it anyway, let the coder beware
instead, you can use one of the variations of alts!
where one channel might have the data you are interested in, and the other immediately returns nil, then check the value and which channel it came from
that can replace some usages of a "peek" logic
@noisesmith: how would peek
cause deadlocks? I remember reading a ML discussion about it but I don't remember
bronsa: between peeking and the execution of your next channel operation, the status of the channel (empty vs. full) could have changed - maybe this can only cause races but not deadlocks though?
@bronsa: it's probably safer / more conservative to say "CSP is a formally proven system for concurrency with no peek operation defined" and leave it at the fact that when you add peek, the proven properties of CSP are no longer guaranteed
I'm probably going to wake up at 3 am and have a full model for how to provoke a deadlock using peek