Please Review: The Heart of Spritely (HoS)

I know that this is a little late, but having just read this document, I have a few additional comments:

I’m curious if there is a Guile Scheme version available? Not to disparage indentation reliant languages (I worked as a Python developer for many years), but I find them difficult to parse reliably, and would actually prefer S-expressions. I had the hardest time copying the code correctly to my guile terminal. For example, my mind kept missing the $ symbol as a relevant piece of code, assuming it was the command prompt! Anyways, just a suggestion.

Secondly, I was wondering throughout when there would be a proof of how Object Capabilities actually achieves it’s claims. An addendum on how this is achieved would be appreciated!

1 Like

Does this link help?

https://spritely.institute/static/papers/test-taste-of-goblins.scm

We actually test compile all the code in the document every build, which includes the
wisp → scheme translation step…

I’ll double check to see if that link is featured in the paper.

Whoops, I thought I had responded to this already!

Thanks @frandallfarmer, I was able to get through the paper using wisp alone, it was just a suggestion that scheme might be more pleasant for some, so the option to view the document with either language might be of some use (say a toggle on the source field). In the least, a link to that translation procedure would be helpful.

Thanks again!

1 Like

Sorry, not sure if I am posting in the right place. I was reading about HOS, Pola, Goblins and such … :heavy_heart_exclamation:
Complexity is not anybodies friend. I can just about comprehend what you are doing. Using/learning yet another language, editing procedure etc. Too hard and time-consuming for me. [shrug]
Some years ago (see link) I created a template for different levels of interaction. It may be relevant. As may other similar projects/ideas that were never implemented.

A project that comes to mind is veilid.com (I probably mentioned that already). I find it interesting that you ask to NOT reveal details of the project. [shrug] It seems a perfect but never to be implemented back burner project is occurring? I hope I am wrong! :sunglasses:

Hello you’ll! Sorry for reopen this thread, if exist a better place to discuss this please let me know!

I have noticed a bug with the paper at page 27 in the code:

REPL [1]> (define forked-motors (spawn ^borked-car-factory "Forked"))
REPL [1]> (define car-vow (<- forked-motors 'make-car "Exploder"
, →
 "red"))
REPL [1]> (define drive-noise-vow (<- car-vow 'drive))
REPL [1]> (on drive-noise-vow
(lambda (val)
(format #t "Heard: ~a\n" val))
#:catch (lambda (err)
(format #t "Caught: ~a\n" err)))

Where I’m getting the exception on the second line:

REPL [1]> (define car-vow (<- forked-motors 'make-car “Exploder” “red”))

Instead of the last one.

Here is what I have done:

  1. Defined ^borked-car-factory in a file named taste_of_goblins.scm;

    (define-module (taste-of-goblins)
      #:use-module (goblins)
      #:use-module (goblins actor-lib methods)
      #:export     (^cell ^greeter ^cgreeter ^borked-cgreeter
    		      ^car-factory ^borked-car-factory))
    
    (define (^borked-car-factory bcom company-name)
      (define (^car bcom model color)
        (methods
         [(drive)
          (format #f "*Vroom vroom!* You drive your ~a ~a ~a!"
    	      color company-name model)]))
      (methods
       [(make-car model color)
        (error "Your car exploded on the factory floor! Ooops!")
        (spawn ^car model color)]))
    
  2. Evaluate this file to a geiser repl C-c C-l;

  3. Entered the repl and changed to taste-of-goblins module:
    REPL> ,m (taste-of-goblins)

  4. Created two vats:

    REPL> (define a-vat (spawn-vat))
    REPL> (define b-vat (spawn-vat))
    
  5. In the first a-vat I defined forked-motors:

    REPL> ,enter-vat a-vat
    REPL [1]> (define forked-motors (spawn ^borked-car-factory "Forked"))
    REPL [1]> ,q
    REPL>
    
  6. In the b-vat I tried to define car-vow like in the paper:

    REPL [1]> (define car-vow (<- forked-motors 'make-car "Exploder" "red"))
    

And them I got the exception:

goblins/1@(taste-of-goblins) \[1\]> Uncaught exception in task:
In fibers.scm:
193:20 15 (*)
In goblins/vat.scm:
1051:12 14 (loop)
1045:9 13 (* \_)
In ice-9/control.scm:
91:24 12 (call-with-escape-continuation \_)
In ice-9/boot-9.scm:
1752:10 11 (with-exception-handler \_ \_ #:unwind? \_ #:unwind-for-type *)
In goblins/vat.scm:
869:6 10 (*)
819:17  9 (vat-churn #<vat id: 0 name: #f> \_ \_)
792:7  8 (turn #<vat-event type: receive timestamp: 3 far-timestamp: 2 message: #< from-vat: # to: #<local-object ^borked-car-factory> resolve-me: # args: (make-car “Exploder” “red”)>>)
In goblins/core.scm:
1700:8  7 (call-with-fresh-syscaller \_ #<procedure 7fb242217200 at goblins/core.scm:2391:3 (sys)>)
2408:9  6 (error-prompt-handler \_ #<&compound-exception components: (#<&error> #<&origin origin: #f> #<&message message: “Your car exploded on the factory floor! Ooops!”> #<&irritants irritants: ()> #<&exception-with-kind-and-args kind: misc-error args: (#f “Your car exploded on the factory floor! Ooops!” () #f)>)> #<stack 7fb24341e680>)
2340:5  5 (simple-display-error #< from-vat: # to: #<local-object ^borked-car-factory> resolve-me: # args: (make-car “Exploder” “red”)> #<&compound-exception components: (#<&error> #<&origin origin: #f> #<&message message: “Your car exploded on the factory floor! Ooops!”> #<&irritants irritants: ()> #<&exception-with-kind-and-args kind: misc-error args: (#f “Your car exploded on the factory floor! Ooops!” () #f)>)> #<stack 7fb24341e680>)
In unknown file:
4 (simple-format #<closed: string 7fb243af3230> “\~%Goblins exception:\~%”)
In ice-9/boot-9.scm:
1685:16  3 (raise-exception \_ #:continuable? \_)
In goblins/vat.scm:
858:14  2 (handle-error #<&compound-exception components: (#<&assertion-failure> #<&origin origin: “simple-format”> #<&message message: “Wrong type argument in position \~A: \~S”> #<&irritants irritants: (1 #<closed: string 7fb243af3230>)> #<&exception-with-kind-and-args kind: wrong-type-arg args: (“simple-format” “Wrong type argument in position \~A: \~S” (1 #<closed: string 7fb243af3230>) (#<closed: string 7fb243af3230>))>)>)
In unknown file:
1 (simple-format #<closed: string 7fb243af3230> “\~a #\~a:\\n” “Exception in vat” 0)
In ice-9/boot-9.scm:
1685:16  0 (raise-exception \_ #:continuable? \_)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure simple-format: Wrong type argument in position 1: #<closed: file 7fb243af3230>

But, by the paper, this exception should be propagated, and should appear only in a on block:

REPL [1]> (define drive-noise-vow (<- car-vow 'drive))
REPL [1]> (on drive-noise-vow
                (lambda (val)
                  (format #t "Heard: ~a\n" val))
              #:catch (lambda (err) 
                        (format #t "Caught: ~a\n" err)))

; prints (eventually):
; Caught: <error...>

I’m currently running guile, fibers and goblins in my guix machine, with the following versions:

 guile                3.0.11     
 guile-fibers         1.4.2      
 guile-goblins        0.17.0     

Thank you’all for the support, sorry the bad english!

1 Like

Hello.

There are a couple of things going on here:

  1. I think you’re running into a gesier bug which is the exception you’re getting. For now you can work around this by following the live hacking “fix” in the Goblins manual.
  2. Goblins will print to standard out anytime a object raises an error when sent a message (with <- or <-np). This is expected behaviour, usually helpful when debugging Goblins code. if you continue with the promise pipelining example you posted, you’ll see the error being propagated through the promises and caught below by the on (occasionally the error obscures the guile prompt in Geiser/REPL, you can just hit enter if you don’t see it).

Your english is great, no need to apologies :slight_smile: Hopefully that helps. If that explanation didn’t make sense or you run into further issues, please follow up and ask again.

2 Likes

Thank you very much @tsyesika!

As a suggestion, it would be cool to have this described at the paper, something like:

In a (Geiser) REPL the exception will be catch, printing:

Goblins exception:
In message to #<local-object ^borked-car-factory>:
(make-car “Exploder” “red”)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Your car exploded on the factory floor! Ooops!
In goblins/core.scm:
1021:7 2 (syscaller-$ _ #<local-object ^borked-car-factory> (make-car “Exploder” “red”))
In …

But, as the exception wasn’t handled, it will be propagated to the next operation:

REPL [1]> (define drive-noise-vow (<- car-vow 'drive))
REPL [1]> (on drive-noise-vow
                (lambda (val)
                  (format #t "Heard: ~a\n" val))
              #:catch (lambda (err) 
                        (format #t "Caught: ~a\n" err)))

; prints (eventually):
; Caught: <error...>
1 Like

Other point I just noticed, shouldn’t this error return

#<&origin origin: "In the message to <local-object ^borked-car-factory>: 
   (make-car "Exploder" "red")">

Or something along the lines? Because right now it is returning just:

Caught: #<&compound-exception components: (#<&error> #<&origin origin: #f> #<&message message: "Your car exploded on the factory floor! Ooops!"> #<&irritants irritants: ()> #<&exception-with-kind-and-args kind: misc-error args: (#f "Your car exploded on the factory floor! Ooops!" () #f)>)>

That I find very hard to debug for bigger pipelines. I think it would be cool to have a “pipeline trace” to, something like:

Caught: ...
at message to #<local-object ^car>:
  (drive)
at message to #<local-object ^borked-car-factory>:
  (make-car "Exploder "red")

What do you think? I could dedicate some time to the error handler if this proposal aligns with Goblins’ objectives :grinning_face:.

That question is quite the deep rabbit hole. What you’re asking for is a distributed debugger, which is something we have started building but haven’t fully built out yet. You can read a blog post about it here: Introducing: A distributed debugger for Goblins with time travel! — Spritely Institute

2 Likes

Thank you! I will have a look at it.