Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support CPS transformations on nnkLambda and non-top-level procs #218

Open
zevv opened this issue Jul 24, 2021 · 1 comment
Open

support CPS transformations on nnkLambda and non-top-level procs #218

zevv opened this issue Jul 24, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@zevv
Copy link
Collaborator

zevv commented Jul 24, 2021

Could we support this?

let foo = proc() {.cps:C.} =  
  echo "foo"  
foo()  

And if possible, even this?

proc foo() {.cps:C.} = 
                      
  proc bar() {.cps:C.} = 
    echo "bar"          
                           
  bar()        
                      
foo()

and this

proc foo() {.cps:C.} = 
  let bar = proc() {.cps:C.} =
    echo "bar"           
  bar()                 
foo()  
@disruptek disruptek added the enhancement New feature or request label Jul 24, 2021
@disruptek
Copy link
Contributor

let foo = proc() {.cps:C.} =  
  echo "foo"  
foo()

I don't see how we can support this as long as the compiler rejects the following:

let foo =
  type C = ref object of Continuation
  proc(): C = echo "foo"

And unfortunately, unless we add an untyped pass, this means we cannot support the last example.

But the 2nd example, sure, we should be able to support that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants