Coder Social home page Coder Social logo

Comments (4)

michallepicki avatar michallepicki commented on August 11, 2024 1

I will try again and report back, thanks for checking!

from sesterl.

michallepicki avatar michallepicki commented on August 11, 2024 1

I must have been running the compiler wrong way somehow, or my editor was playing tricks with me, I am getting errors now!

BTW: WOW this is very cool

from sesterl.

gfngfn avatar gfngfn commented on August 11, 2024

I even tried changing let n = 10 in to let n = "10" in and didn't get any errors

I couldn't reproduce this problem. The following change is rejected as intended:

 module Example = struct

   /* dummy */
   val some_heavy_calculation(n) =
     n

   val rec wait_all(msgacc, n) = act
     if n <= 0 then
       return(msgacc)
     else
       receive
       | {pid, msg} ->
           let _ = print_debug(format(f'message ~p received from: ~p~n', {msg, pid})) in
           wait_all(msg :: msgacc, n - 1)
       end

   val rec spawn_all(pidacc, n) = act
     if n <= 0 then
       return(pidacc)
     else
       do parent <- self() in
       do pid <-
         spawn(fun() -> act
           do me <- self() in
           let msg = some_heavy_calculation(n) in
           send(parent, {me, msg})
         end)
       in
       spawn_all(pid :: pidacc, n - 1)

   val main(arg) = act
-    let n = 10 in
+    let n = "10" in
     do pids <- spawn_all([], n) in
     let _ = print_debug(format(f'spawned: ~p~n', {pids})) in
     do msgs <- wait_all([], n) in
     let _ = print_debug(msgs) in
     return({})

 end
$ sesterl build example.sest -o _generated/
  parsing '<path/to>/example.sest' ...
  type checking '<path/to>/example.sest' ...
! [Type error] file 'example.sest', line 33, characters 15-24:
  this expression has type
    fun(list<pid<'a>>, int) -> [{pid<'a>, int}]list<pid<'a>>
  but is expected of type
    fun(list<pid<'a>>, binary) -> [{pid<'a>, int}]list<pid<'a>>

from sesterl.

gfngfn avatar gfngfn commented on August 11, 2024

Iā€™m glad to hear that. Thank you anyway for reporting!

from sesterl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.