Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5963539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:16:15+00:00 2026-05-22T19:16:15+00:00

Is it correct that reset requires shift inside the block? I tried it and

  • 0

Is it correct that reset requires shift inside the block? I tried it and got the following:

scala> reset {} 
error: cannot cps-transform expression (): type arguments [Unit,Unit,Nothing]
do not conform to method shiftUnit's type parameter bounds [A,B,C >: B]

It looks reasonable (since reset block without shift inside is “dead code”, which is never executed) but I do not understand the error.

What is the exact meaning of the error message?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:16:16+00:00Added an answer on May 22, 2026 at 7:16 pm

    I don’t agree, that code within reset is dead without shift. Actually reset just defines the boundaries of a continuation (that’s because they are called delimited continuations).The code would be dead if you have shift somewhere within reset and you do not call continuation function. For example:

    reset {
      println(1)
      shift((k: Unit => Unit) => println(2))
      println(3)
    }
    

    The code after shift is dead (println(3)) because I have not called k(Unit).

    From the other hand, seems that reset expects some special return type from it’s body – the one that annotated with @cpsParam annotation. You can check definition of reset method:

    def reset[A,C](ctx: => (A @cpsParam[A,C])): C = ...
    

    And shift produces just what reset method expects. Here is definition of shift method:

    def shift[A,B,C](fun: (A => B) => C): A @cpsParam[B,C] = ...
    

    But you still can use reset without shift call within it. This trick will do it:

    def foo[T](body: => T @cps[Any]) = reset(body)
    
    foo {
      println("it works")
    }
    

    Please note, that @cps is just type alias for @cpsParam. Here it’s definition:

    type cps[A] = cpsParam[A, A]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am I correct in understanding that mysql's LAST_INSERT_ID() function doesn't reset between insert attempts
Is it correct that the reveal applescript command is broken with iTunes 9? Works:
I'm new to Symfony. Is my understanding correct that the User class is actually
(1). When using C++ template, is it correct that the compiler (e.g. g++) will
My Visual Studio 2008 debugger is showing integers as hexadecimals, how to correct that?
Like in: u'Hello' My guess is that it indicates "Unicode", is that correct? If
Am I correct in assuming that the only difference between "windows files" and "unix
Am I correct in assuming that I always need to explicitly deploy referenced assemblies
Is it correct to say that typically user_dump_dest is on a local drive? If
Is it correct to assume that JQuery is not actually an implementation of ECMA

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.