digego / extempore

A cyber-physical programming environment
1.4k stars 127 forks source link

setting env vars from scheme post 0.7 #273

Open digego opened 8 years ago

digego commented 8 years ago

can't set env vars from scheme in aot code since 0.7

JimKuhn commented 8 years ago

It seems to work for me on Linux (at least) (?).

I added this to an aot module:

(impc:aot:do-or-emit
  (define EnvTest
    (lambda ()
      (sys:set-env "dummy_env" "ABC"))))

I then loaded it (post aot-compile) and executed:

(EnvTest)
($ (printf "%s\n" (getenv "dummy_env")))

ABC
benswift commented 8 years ago

Hi Andy, what do you mean by "can't set env vars from scheme in aot code" - do you mean the scheme wrappers don't work? Because obviously plain scheme (as per Jim's example) is never AOTed.

digego commented 8 years ago

I'm talking about an xtlang closures captured variables. not the shell's environment variables.

(bind-func test (let ((x:i64 0)) (lambda () (* 2 x))))

;; this works OK for non-ato'd code but not for aot lib (println (test)) (test.x 5) (println (test))

;; this always works ($ (println (test))) ($ (test.x:i64 10)) ($ (println (test)))

Don't fuss though guys, the note is for me to chase when I have time.

On Tue, Jun 21, 2016 at 11:10 AM, Ben Swift notifications@github.com wrote:

Hi Andy, what do you mean by "can't set env vars from scheme in aot code"

  • do you mean the scheme wrappers don't work? Because obviously plain scheme (as per Jim's example) is never AOTed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/digego/extempore/issues/273#issuecomment-227314366, or mute the thread https://github.com/notifications/unsubscribe/AAh3qVopFryUtReUlJpL2fvEKEpszQI1ks5qNzoKgaJpZM4I375- .

benswift commented 8 years ago

Ok, cool. Andrew Sorensen notifications@github.com writes:

I'm talking about an xtlang closures captured variables. not the shell's environment variables.

(bind-func test (let ((x:i64 0)) (lambda () (* 2 x))))

;; this works OK for non-ato'd code but not for aot lib (println (test)) (test.x 5) (println (test))

;; this always works ($ (println (test))) ($ (test.x:i64 10)) ($ (println (test)))

Don't fuss though guys, the note is for me to chase when I have time.

On Tue, Jun 21, 2016 at 11:10 AM, Ben Swift notifications@github.com wrote:

Hi Andy, what do you mean by "can't set env vars from scheme in aot code"

  • do you mean the scheme wrappers don't work? Because obviously plain scheme (as per Jim's example) is never AOTed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/digego/extempore/issues/273#issuecomment-227314366, or mute the thread https://github.com/notifications/unsubscribe/AAh3qVopFryUtReUlJpL2fvEKEpszQI1ks5qNzoKgaJpZM4I375- .


You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/digego/extempore/issues/273#issuecomment-227315595