Re: [racket-dev] relationship between define-struct and struct

2010-08-30 Thread Matthew Flatt
I've fixed `define-struct' in *SL to omit a reference to the
non-existent `struct:' binding, so `struct-out' now works with the
definitions.

The error message from `struct-out' is also fixed to say binding
instead of import.

At Sat, 28 Aug 2010 16:15:26 -0600, Jay McCarthy wrote:
 The student languages have a completely separate implementation of
 define-struct from Racket.
 
 [lang/private/teach.rkt: do-define-struct: line 716
 
 For a reason unknown to me, the struct type descriptor [line 805]
 returned by make-struct-type does not get defined (although it does
 check to make sure it could be defined.) [line 931]
 
 I'm not entirely sure why this is although I anticipate that is has to
 do with the fact that such a value has no worth in *SL, because there
 are no operations on it. Thus it would be very awkward in the docs to
 say that a thing is defined with define-struct that has no meaning to
 students.
 
 Since struct-out expects this thing to be defined, it errors. It is a
 bit awkward that the error suggests that it should have been imported,
 rather than defined in the file.
 
 Jay
 
 On Sat, Aug 28, 2010 at 1:23 PM, Shriram Krishnamurthi s...@cs.brown.edu 
 wrote:
  What is the relationship between define-struct and struct in Racket
  5.0.1?  By define-struct I mean the construct provided in ASL.  In my
  custom language I have
 
  (define-struct tv (tag value))
  (provide (struct-out tv))
 
  and I get the error
 
  struct-out: no import for structure-type identifier in: struct:tv
 
  Is this because define-struct suppresses the struct:tv structure-type
  information?  (If so, why?)  ((And if so, is there a way to make
  struct-out work shy of copying the implementation of define-struct and
  adding/removing the line that hides this?))
 
  Shriram
  _
   For list-related administrative tasks:
   http://lists.racket-lang.org/listinfo/dev
 
 
 
 
 -- 
 Jay McCarthy j...@cs.byu.edu
 Assistant Professor / Brigham Young University
 http://teammccarthy.org/jay
 
 The glory of God is Intelligence - DC 93
 _
   For list-related administrative tasks:
   http://lists.racket-lang.org/listinfo/dev
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

[racket-dev] relationship between define-struct and struct

2010-08-28 Thread Shriram Krishnamurthi
What is the relationship between define-struct and struct in Racket
5.0.1?  By define-struct I mean the construct provided in ASL.  In my
custom language I have

(define-struct tv (tag value))
(provide (struct-out tv))

and I get the error

struct-out: no import for structure-type identifier in: struct:tv

Is this because define-struct suppresses the struct:tv structure-type
information?  (If so, why?)  ((And if so, is there a way to make
struct-out work shy of copying the implementation of define-struct and
adding/removing the line that hides this?))

Shriram
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] relationship between define-struct and struct

2010-08-28 Thread Shriram Krishnamurthi
On Sat, Aug 28, 2010 at 3:38 PM, Robby Findler
ro...@eecs.northwestern.edu wrote:
 This works fine in #lang racket, eg:

 #lang racket
 (define-struct s (a b))
 (provide (struct-out s))

 I think that ASL's define-struct is not racket's tho, so you'd
 probably have to read the docs carefully to understand what's
 different and what it does and why it is not working properly with
 racket's struct-out.

Yes, thank you, you've just repeated my question...
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] relationship between define-struct and struct

2010-08-28 Thread Jay McCarthy
The student languages have a completely separate implementation of
define-struct from Racket.

[lang/private/teach.rkt: do-define-struct: line 716

For a reason unknown to me, the struct type descriptor [line 805]
returned by make-struct-type does not get defined (although it does
check to make sure it could be defined.) [line 931]

I'm not entirely sure why this is although I anticipate that is has to
do with the fact that such a value has no worth in *SL, because there
are no operations on it. Thus it would be very awkward in the docs to
say that a thing is defined with define-struct that has no meaning to
students.

Since struct-out expects this thing to be defined, it errors. It is a
bit awkward that the error suggests that it should have been imported,
rather than defined in the file.

Jay

On Sat, Aug 28, 2010 at 1:23 PM, Shriram Krishnamurthi s...@cs.brown.edu 
wrote:
 What is the relationship between define-struct and struct in Racket
 5.0.1?  By define-struct I mean the construct provided in ASL.  In my
 custom language I have

 (define-struct tv (tag value))
 (provide (struct-out tv))

 and I get the error

 struct-out: no import for structure-type identifier in: struct:tv

 Is this because define-struct suppresses the struct:tv structure-type
 information?  (If so, why?)  ((And if so, is there a way to make
 struct-out work shy of copying the implementation of define-struct and
 adding/removing the line that hides this?))

 Shriram
 _
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev




-- 
Jay McCarthy j...@cs.byu.edu
Assistant Professor / Brigham Young University
http://teammccarthy.org/jay

The glory of God is Intelligence - DC 93
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev