-
Notifications
You must be signed in to change notification settings - Fork 58
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
local
streams can escape their lexical scope
#253
Comments
I think that if the reification of all expressions was memoized using |
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
@robdockins Just keeping you in the loop. We had a quick discussion about this today. This looks like a proper bug and should take priority. We probably won't be able to fix it before the very next release (3.6), but we'll try to address it by the following one. |
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
…odule. Some example specs generated these nodes. Note, however, that the support for `local` here suffers from the same issue as the C code generator and interpreter do regarding locals that may escape their scope (CF Copilot-Language#253).
Description C99 backend generates incorrect code when Type
Additional context
Requester
Method to check presence of bug Given this Copilot spec: {-# LANGUAGE CPP #-}
module Main where
import qualified Prelude as P
import Language.Copilot hiding (interpret)
#ifdef COMPILE
import Copilot.Compile.C99
#else
import Copilot.Interpret
#endif
delayed :: Stream Word8
delayed = local (constW8 1) $ \t -> [0] ++ t
spec :: Spec
spec =
trigger "on" (delayed < 10) [arg delayed]
main :: IO ()
main = do
spec' <- reify spec
#ifdef COMPILE
compile "local" spec'
#else
putStrLn (interpret Table 10 spec')
#endif Running or compiling that code results in errors both using the interpreter and the C99 backend:
Expected result The executions above should execute without failures. The interpreter should produce no output. Desired result The executions above should execute without failures. The interpreter should produce no output. Proposed solution To be determined. Further notes None. |
Change Manager: Confirmed that the issue exists. |
Technical Lead: Confirmed that the issue should be addressed. |
The
local
combinator is intended to act like an internallet
operation, but doesn't seem to be handled correctly. In particular, if a stream bound vialocal
is passed into an operator that usesDrop
orAppend
, the resulting local variable will be referred to out of context. This is basically because code consuming coreStream
definitions expects the stream recurrence expression not to have any free variables, but this is not guaranteed by reification. In contrast, an ordinary Haskelllet
has the desired behavior.This can be seen in both the stream interpreter and in the code generator. Consider the following spec:
When interpreted, this yields:
When used for code generation, this yields code which, when compiled, causes:
The text was updated successfully, but these errors were encountered: