-
Notifications
You must be signed in to change notification settings - Fork 5
Runtime & Better Contracts #26
base: master
Are you sure you want to change the base?
Conversation
Hi, I have been super busy and haven't been able to do all the planned changes yet. But, I am slowly working on this. One decision I need to take now is about the Special Forms. I am considering to bake the special-forms handling into the Runtime itself. It will remain the responsibility of Runtime to handle the special form during
For the built-in basic runtime implementation provided in the
@lthibault Let me know your thoughts. And also, if i have missed any essential special form. |
LGTM. I agree with both points regarding the integration of special forms into Regarding Would it make sense to use functional options, as in the // signature: func New(parent runtime.Runtime, opt ...runtime.Option) runtime.Runtime
runtime.New(nil, runtime.WithDefault, somelib.WithFoo) I think this is a nicer API for users as well. |
Yea it is. I didn't really go with flags. :) I mentioned it here but then decided probably not a good idea. |
@spy16 Just wondering: does anything else still need implementing, or can we begin the formal code-review/merge process? |
@spy16 can we get rid of the Right now my banner looks like this: $ go run cmd/ww/main.go
Wetware v0.0.0, go1.14
Copyright 2020 The Wetware Project
ww » But I want it to look like this: $ go run cmd/ww/main.go
Wetware v0.0.0, go1.14
Copyright 2020 The Wetware Project
ww » |
@spy16 I have some spare cycles beginning next week -- is there anything I can do to help move this forward? This is becoming a bit of a blocking issue on my end, so I'm happy to pick up some of the slack. 🙂 |
Hey @lthibault, Very sorry for the delay here. I ran into couple of issues while working on this refactor.
I was experimenting with an approach very similar to Clojure and the Joker (#18) and i think i was close to solving both the issues. But my father had a heart attack (He is fine now) and I had to take a break from work and this. I plan on looking at this again this weekend but unsure about timelines. Here's what Clojure does:
def eval(form):
meta = get_meta(form) # may be null if not set.
bindings = merge(meta, get_position_info(form)) # file, line, col
form = macro_expand(form)
expr = analyze(form)
return expr.eval() Notice how instead of evaluating the value directly, it turns values into Joker being Clojure in Go, replicates a similar design. I have some ideas on a similar approach. Also, I saw your PR in which you said the design of atoms had to change for your use-case. I would definitely like to hear about the requirements. Finally, If delay here is blocking you, it might make sense to fork this repo or even copy and merge it into your project I think. I know this is not ideal and it's not how i wanted it as well. But considering my situation and possibility that there might be further delay, I don't want this to become a bottleneck. |
@spy16 I'm terribly sorry to hear about your father! I'm glad he's alright now, although you and your family must still be reeling from the shock. By all means take your time ... this can wait. In the meantime, thanks for your response -- I'm all the more grateful for your insights given the situation. I'm going to proceed as follows for the time being:
Let me know when you're back in action and we can compare notes. I'll try to move some things around on my end so that I can be available for implementation work when you return. P.S.: I'm more than happy to fill you in on the requirements for Wetware. Let's have that discussion over at #27, at your convenience. |
This PR has the new structure and types as per the discussions on #25 . New contracts are nested within a sub-package
sabre
for the time being (Just to make it easy to move.)..Highlights:
runtime
contains all the core interfaces/types that Sabre deals with - Runtime, Value, Invokable, Seq, Seqable, Vector, Map, Set & a common Error type.reader
package contains the Reader.reader.New
returns a reader instance that can read the primitive types defined in runtime. For map, vectors, sets,reader
providesMapReader(mapFactory)
,VectorReader(vectorFactory)
,SetReader(setFactory)
reader-macro implementation.. With the factory argument, makes it easy to use any map implementation.repl
package remains the same.core
package is in the works and will contain the function value, macro system, special form type and built-in special forms.Opening this incomplete PR to get feedbacks early on. (Expect lot of random commits here. I will be rewriting commit history to make sense before merge)