Giter Club home page Giter Club logo

Comments (6)

hyln9 avatar hyln9 commented on September 22, 2024

I knew about this problem. Let's wait until the brainstorming session on friday to see what the best way to resolve the repl issues.

Launchpad Details: #LPC Abdulaziz Ghuloum - 2007-11-14 21:48:48 -0500

from ikarus.

hyln9 avatar hyln9 commented on September 22, 2024

There is a hack that I just thought of that might push this problem further.

The expander could be made to allow importing an identifier that exists in the top level but whose value is not yet defined. So, you won't get hosed in the example you mentioned, but you'd still get weird results if you do:

(define (bar) foo)
(bar)
Error, foo is unbound
(import (import-bug))
foo
1 ;;; we're cool
(bar)
Error, foo is unbound!!!!
(define (bar) foo)
(bar)
1 ;;; we're cool again?

I don't know if this is better. What do you think?

Launchpad Details: #LPC Abdulaziz Ghuloum - 2007-11-26 05:00:28 -0500

from ikarus.

hyln9 avatar hyln9 commented on September 22, 2024

Does your example amount to there being two different "foo"? The first one is the "unbound" foo that exists until the import and the second one is from the library. Thus the first bar will always point at unbound-foo and it doesn't get changed until the redefinition which references library-foo. Is that the right way to understand it?

What about an example like:

(define (bar) foo)
(import (import-bug))
(bar)
;;; Are we cool??

If top level imports behaved similar to top-level recursive defines, the mental model might be easier to work with. Consider the examples:

(define (bar) foo)
(define (foo) bar)
(foo)
#
(bar)
#

(define (bar) foo)
(bar)
Error, foo unbound!!
(define (foo) bar)
(bar)
#
;; We're cool

Launchpad Details: #LPC Michael D. Adams - 2007-11-26 11:03:11 -0500

from ikarus.

hyln9 avatar hyln9 commented on September 22, 2024

On Nov 26, 2007, at 11:03 AM, Michael D. Adams wrote:

Does your example amount to there being two different "foo"? The
first
one is the "unbound" foo that exists until the import and the
second one
is from the library. Thus the first bar will always point at unbound-
foo and it doesn't get changed until the redefinition which references
library-foo. Is that the right way to understand it?

I think that's what I meant, yes. Basically, an import brings the
imported variables into scope. It does not mutate the existing
bindings.

What about an example like:

(define (bar) foo)
(import (import-bug))
(bar)
;;; Are we cool??

With what I'm suggesting, you'd get an unbound variable error since
foo is unbound.

If top level imports behaved similar to top-level recursive
defines, the
mental model might be easier to work with. Consider the examples:

It might be, but there are always some corner cases. What will
happen in the following case?

(define (set-foo! x) (set! foo x))
(define (get-foo) foo)
(import (import-bug)) ;;; this currently fails, but if we make
it pass, ...
foo
1 ;;; this would have to be 1
(get-foo)
1 ;;; should this be an error, or should it
be 1?
(set-foo! 17) ;;; now what? Which foo has changed?
(get-foo)
???
foo
???

Note that we haven't even gotten into the issues with macros yet :-)

Launchpad Details: #LPC Abdulaziz Ghuloum - 2007-11-26 19:47:52 -0500

from ikarus.

hyln9 avatar hyln9 commented on September 22, 2024

Not sure on the progress of this but here is another example:

Ikarus Scheme version 0.0.2patched+ (revision 1285, build 2007-12-24)
Copyright (c) 2006-2007 Abdulaziz Ghuloum

bar
Unhandled exception
Condition components:

  1. &assertion
  2. &who: eval
  3. &message: "unbound variable"
  4. &irritants: (bar)
    (library (foo) (export bar) (import (rnrs)) (define bar #t))
    (import (foo))
    Unhandled exception
    Condition components:
    1. &who: import
  5. &message: "identifier conflict"
  6. &syntax:
    form: (import (foo))
    subform: bar

Launchpad Details: #LPC leppie - 2007-12-27 10:39:30 -0500

from ikarus.

hyln9 avatar hyln9 commented on September 22, 2024

Wow! Finally! Fixed in revision 1459.

Launchpad Details: #LPC Abdulaziz Ghuloum - 2008-05-01 04:33:53 -0400

from ikarus.

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.