Convex-Dev / convex-web

https://convex.world
15 stars 18 forks source link

Inconsistent mapping of Convex objects to Clojure(script) #70

Closed helins closed 3 years ago

helins commented 3 years ago

When some gen test fails, I often test the scenario manually in the sandbox. I've noticed a few times that there are some inconsistencies in type mapping, sometimes, with more complex inputs.

For example

[{nil 'E, 3.0 :CN} {\tab 0x02, nil true}]

;; => [{3 :CN, nil E} {"\t" "02", nil true}]

Here 3.0 looks like a long, \tab char is converted to a string, 0x02 blob to a hexstring.

I know type mapping is not always easy, especially when CLJS is involved. But it seems to be about how collections are mapped since scalar values behave fine. I don't know if my version of datatafy might help? I can help if needed :)

And while we are at it, it would be nice finding a notation for syntaxes. Right now, they look transparent:

(syntax 42)

=> Shows 42

But of course they are not:

(+ 42 (syntax 42))  ;; Fails
mikera commented 3 years ago

I think racket uses #' for their version of Syntax Objects. Might be a good idea to copy this. Or possibly use the backquote ` for "syntax quote".

sbelak commented 3 years ago

Shouldn't it be as homoiconic as possible, ie backquote?

pedrorgirardi commented 3 years ago

Yes @helins, we could try to copy some of your datafy implementation.

mikera commented 3 years ago

@sbelak Yes I think that is probably best. We need to revisit the whole Syntax model though to some extent. It's currently a pain to do unsyntax in many macros. I have a feeling there is a much smarter way to do this but haven't quite nailed it yet.

See also #110

pedrorgirardi commented 3 years ago

Fixed.

Please see https://github.com/Convex-Dev/convex-web/issues/66