This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-02
Channels
- # announcements (12)
- # babashka (7)
- # babashka-sci-dev (46)
- # beginners (35)
- # biff (1)
- # calva (4)
- # cider (22)
- # clj-kondo (48)
- # clj-on-windows (4)
- # clojure (132)
- # clojure-europe (161)
- # clojure-germany (1)
- # clojure-nl (2)
- # clojure-uk (5)
- # clojurescript (39)
- # conjure (10)
- # core-typed (1)
- # cursive (48)
- # datalevin (6)
- # datascript (12)
- # datomic (9)
- # emacs (5)
- # events (1)
- # figwheel-main (2)
- # honeysql (7)
- # hyperfiddle (35)
- # improve-getting-started (8)
- # introduce-yourself (4)
- # london-clojurians (1)
- # off-topic (20)
- # podcasts (1)
- # re-frame (45)
- # reitit (5)
- # releases (2)
- # rum (7)
- # shadow-cljs (20)
- # spacemacs (4)
- # tools-build (58)
- # tools-deps (19)
- # xtdb (56)
@borkdude About SCI ClojureDart support (https://github.com/babashka/sci/issues/718), let me know if you have tried something already. Otherwise I can try to dig into the code during the nights of this week to see what you had to do to support both CLJ and CLJS (in a first view, it seems they are much more alike to each other than ClojureDart is, is this true?).
Ok, checked here, lots of errors ahahaha, no extend-protocol (but it seems to be a easy macro to do as extend-type
already exists), no instance? (existing issue), among others. Will take another look tomorrow
Should we set up a branch to develop in? Instance? Is replaced by something else in cljd
@U5R6XUARE I have a branch clojure-dart
in SCI now, maybe you can start making incremental PRs against that branch and we can discuss each step
Nice, thanks, Michiel! I've copied the SCI code to a local dart starter project, but I can put it in this branch tonight o/ Let's iterate
We can decide to just not support features if the ClojureDart host doesn't yet support them, like multi-methods
I'm trying to make something work at https://github.com/pfeodrippe/sci-test/compare/test?expand=1 (after I get something working, I can push to sci
). The approach I am trying is a little fuzzy, just doing whatever is needed to make it work (at least compiling green) on top of the existing SCI code (but acting as if other languages didn't exist) and later we can reconcile it with the existing codebase.
I find it easier to find big roadblocks this way. BTW, clojure.tools.reader (reader types ns) seems to be one of these. I will check if we will need to use something completely different or if we can make it work by adding a third env (cljd) to https://github.com/clojure/tools.reader.
Thinking further, do you think edamame will be a big pain?
@U5R6XUARE What does cljd use to read forms? It may not have a reader at the level of .cljd yet? If so, then that's the first major roadblock, I guess
In the sci.parser namespace we could switch to something else than edamame, if cljd has a reader we can use
@U5R6XUARE @U2N9GDB1U kindly answered:
> if you look at the ns cljd.test-reader.reader-test
in the compiler you have examples
Nice, thanks, Michiel and Baptiste! Will take a look tonight
Ok, have been able to compile* a a part of cljd tools reader that SCI uses (https://github.com/pfeodrippe/sci-test/compare/test?expand=1#diff-1e53ca04b5396136017113fcfbd2c9ea66fe71626a43f80e8bc6abf3b4e5f605), tomorrow or the next day I will start focusing in some edamame-ish code (`sci.impl.parser`). *It's green, but there are some dynamic warnings, I will deal with them later
@U5R6XUARE Awesome. The files you've copied, are they part of clojuredart?
No, they are not, I'm following their repo for new changes o/ There is only a https://github.com/Tensegritics/ClojureDart/blob/main/clj/src/cljd/reader.cljd that we certainly can use inside the tools reader namespaces. The files there are the SCI namespaces + whatever namespaces from other libraries are needed to make it compile. After everything is green, we can fix the rough bits, take it to the SCI repo, remove non-applicable parts (like defmethoda) and let the tests talk by themselves
@U5R6XUARE We could also focus on just making eval-form
work
and then use the reader that comes with clojure-dart - unless I'm not understanding things correctly
Yes yes, I will check that, thanks! This one does not depends on the parser (so no need for clojure tools reader or edamame for these?), right? At least not directly in the interpreter ns. Let me know of other low-hang fruits if you remember o/
not sure if the namespace organization still requires this, but we can probably do something about that
Awesome! The only thing a little bit hard to read are the interleaved reader conditionals in cljc files for the same form (specially inside defrecord or deftypes), but this is Clojure's fault and, in the end, it becomes less code to maintain. I wish I had more than 1 or 2 hours per day to work on this ahahahahah SCI is such a great project.
Have been able to compile the code for eval-form
, now will try to solve the errors when I try to run it (it should be related to the build warnings)
➜ dartapp git:(test) ✗ dart run
Building package executable...
Failed to build dartapp:dartapp:
lib/cljd-out/sci/impl/vars.dart:250:12: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
dc.dynamic clojure.core/meta(){
^^^^^^^
lib/cljd-out/sci/impl/vars.dart:250:24: Error: Expected '{' before this.
dc.dynamic clojure.core/meta(){
^
lib/cljd-out/sci/impl/vars.dart:250:12: Error: The name of a constructor must match the name of the enclosing class.
dc.dynamic clojure.core/meta(){
^^^^^^^
lib/cljd-out/sci/impl/vars.dart:250:1: Error: Constructors can't have a return type.
Try removing the return type.
dc.dynamic clojure.core/meta(){
^^
lib/cljd-out/sci/impl/vars.dart:250:24: Error: Operator declarations must be preceded by the keyword 'operator'.
Try adding the keyword 'operator'.
dc.dynamic clojure.core/meta(){
^
lib/cljd-out/sci/impl/vars.dart:250:24: Error: A method declaration needs an explicit list of parameters.
Try adding a parameter list to the method declaration.
dc.dynamic clojure.core/meta(){
^
lib/cljd-out/sci/impl/vars.dart:250:25: Error: Expected '{' before this.
dc.dynamic clojure.core/meta(){
^^^^
lib/cljd-out/sci/impl/vars.dart:250:24: Error: Operator '/' should have exactly one parameter.
dc.dynamic clojure.core/meta(){
^
lib/cljd-out/sci/impl/vars.dart:250:25: Error: 'meta' is already declared in this scope.
dc.dynamic clojure.core/meta(){
^^^^
lib/cljd-out/sci/impl/vars.dart:238:7: Context: Previous declaration of 'meta'.
final meta;
...
...
...
Trying to workaround some ClojureDart issues, see https://github.com/Tensegritics/ClojureDart/issues/70 and https://github.com/Tensegritics/ClojureDart/issues/69 (this one for reflection), #70 was 🤯.
I have been able to eval constants for now (do 3)
=> 3
haeuaehuheuheau not very interesting
Instead of instance?
I believe you need to use this right?
https://github.com/Tensegritics/ClojureDart/blob/main/doc/differences.md#no-instance
Yes, I'm trying to create a custom instance?
for SCI just to make it work. dart/is?
does not receive accept dynamic class (it has to be known at compile time), this is why I'm checking if it's possible to use dart:mirrors for reflection for now, let's see if it works o/
You can see at https://github.com/pfeodrippe/sci-test/compare/test?expand=1 o/ Making SCI work should be the target for every new Clojure runtime from now on ahahahaah
It lets you know what you are missing
Now we can parse simple expressions!!!
(ns quickstart.helloworld
(:require
[sci.core :as sci]))
(defn main []
(println (sci/eval-form (sci/init {})
'(+ 1 2))
"\n"
(sci/eval-form (sci/init {})
'(+ 4 (- 5 1)))
"\n"
(sci/eval-form (sci/init {})
'(-> (- 5 1)
(+ 4)
(* 2)
(+ 10)))))
;; =>
;; 3
;; 8
;; 26
I've opened https://github.com/pfeodrippe/sci/pull/1 and will be updating there (it's using an old src/sci
commit, but we can update when this is working). For these next 3 weeks, I will be moving from Brazil to Canada, so things will probably be slower, but I will try to advance as much as I can, it's exciting!
@U5R6XUARE Excellent :) Good luck moving to Canada!
Thanks!
Now I'm more settled here and will be able to start again, right away just bumped at some Dart compilation problem haeuaheuahue will try to figure out what's happening to open an GH issue
Thanks
Sorry man, couldn't do anything these days, still trying to figure things out here :/
@U5R6XUARE Oh no problem at all! There is absolutely no pressure from my side :-)