naomijub / edn-rs

[DEPRECATED]: Crate to parse and emit EDN
https://crates.io/crates/edn-rs
MIT License
81 stars 14 forks source link

1.0.0 pub API #136

Closed Grinkers closed 3 months ago

Grinkers commented 9 months ago

Not including #119 what's the best way to discuss and coordinate all the breaking changes/behaviors to get to 1.0.0? I think if we try to do it all in one go in one place, nobody is going to be able to follow or track all the discussions/bikeshedding. I'll do the work, but would like to be efficient about it.

Also, from a high level view, what's the priority? Do we want things to be more like clojure or more like rust? Given it's EDN, and probably almost always going to be used with clojure(script), maybe it should be more like clojure?

Here's a couple examples of things I'm messing around with on https://github.com/Grinkers/edn-rs/tree/bikeshed

clojure

(boolean "foobar") => true
(int "123") => java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Character [at <repl>:2:1]

edn-rs

Edn::Str("foobar".to_string()).to_bool() -> None
Edn::Str("123".to_string()).to_int() -> Some(123)
Grinkers commented 3 months ago
Edn::Int(42).to_char() -> None
(char 42) -> \*

I think a lot of the methods here https://docs.rs/edn-rs/latest/edn_rs/edn/enum.Edn.html#implementations are confusing. I'm thinking we should remove it all or specify a spec (eg. try to match clojure.core). I really wish there was an easy way to iterate over all collections, like clojure. I think it can only be done with a new type.

Grinkers commented 3 months ago

https://github.com/edn-rs/edn-rs/issues/158