[racket-dev] Modules with images can not be mashalled?!

2010-11-18 Thread Benjamin Seppke

Hi,

we use DrRacket for educational purpose at our University and have found 
out some strange behavior of the module system.


For one excercise, we provide a racket module containing (and providing) 
symbols that have images (of flags) as values. The students should use 
these images to visualize the results of their programs.


When the module file is put in the same directory  as the students' 
excercise file, Racket gives an error message after (require 
flag-module.rkt) telling us:


write: cannot marshal constant that is embedded in compiled code: 
(object:image-snip% ...)


Okay, so marshalling is the problem here... However, it works if we add 
the file to the collects/XXX Folder and load it via (require 
xxx/flag-module) - maybe because collect modules are not compiled again?


It also works if I uncheck fill compiled/-directories in 
Language-Select lang-Details. Although this works, I would prefer a 
successful loading of modules, which contain images, without disabling 
the compilation. As I'm not too familiar with Racket's internals, I'm 
asking if there is a way to achieve that. Or - maybe - if this behavior 
is by design, and Racket is supposed to work like that?


Btw, I am using Racket 5.0.1 @ Mac OS X 10.5, but this behavior seems to 
occur independently of the OS.


Best regards,
Benjamin Seppke
_
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] Tab switching keyboard shortcuts on Mac

2010-11-18 Thread Dmitry Chestnykh
 FWIW, Chrome seems to use Cmd+Option+Left and Cmd+Option+Right.

It's the second most popular shortcut for this (AFAIK, Adium uses it),
however it doesn't work for me in 7.0.517.44 anymore.

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


Re: [racket-dev] Modules with images can not be mashalled?!

2010-11-18 Thread Matthias Felleisen


I can confirm this behavior and I consider it a bug. I have submitted a bug 
(#11448) in your name so that you hear back when we get around to fixing it. 

In the meantime, I propose you use the work arounds that you have figured out. 

Sorry for any inconvenience -- Matthias





On Nov 18, 2010, at 4:38 AM, Benjamin Seppke wrote:

 Hi,
 
 we use DrRacket for educational purpose at our University and have found out 
 some strange behavior of the module system.
 
 For one excercise, we provide a racket module containing (and providing) 
 symbols that have images (of flags) as values. The students should use these 
 images to visualize the results of their programs.
 
 When the module file is put in the same directory  as the students' excercise 
 file, Racket gives an error message after (require flag-module.rkt) telling 
 us:
 
 write: cannot marshal constant that is embedded in compiled code: 
 (object:image-snip% ...)
 
 Okay, so marshalling is the problem here... However, it works if we add the 
 file to the collects/XXX Folder and load it via (require xxx/flag-module) - 
 maybe because collect modules are not compiled again?
 
 It also works if I uncheck fill compiled/-directories in Language-Select 
 lang-Details. Although this works, I would prefer a successful loading of 
 modules, which contain images, without disabling the compilation. As I'm not 
 too familiar with Racket's internals, I'm asking if there is a way to achieve 
 that. Or - maybe - if this behavior is by design, and Racket is supposed to 
 work like that?
 
 Btw, I am using Racket 5.0.1 @ Mac OS X 10.5, but this behavior seems to 
 occur independently of the OS.
 
 Best regards,
 Benjamin Seppke
 _
 For list-related administrative tasks:
 http://lists.racket-lang.org/listinfo/dev

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


Re: [racket-dev] [racket] newbie: foreign C structure definition question

2010-11-18 Thread Eli Barzilay
[redirected to dev again]

15 minutes ago, Hendrik Boom wrote:
 On Tue, Nov 16, 2010 at 11:37:17PM -0500, Eli Barzilay wrote:
  Three minutes ago, Jay McCarthy wrote:
   We could use a syntax parameter in define-cstruct to communicate to
   the vector syntax to give them the correct size in structs and make
   my macro's approach the normal behavior.
  
  * Types in a cstruct are plain expressions (that should evaluate to
ctype values).
  
  * Arrays should be available as a type outside of cstructs too.
 
 An array of, say, ten elements should be passes the same way as a
 struct with the same ten elements.

Yes, what I said earlier is that it really boils down to being able to
define a libffi type descriptor with some manually specified size and
alignment.  It's also how the current hackarounds all work.


 That C doesn't do this is a flaw in its calling interface.

And that actually is another problem for Sam when he implements this
-- dealing with whatever situations make C expect the array to be
passed by value (a real one, with the whole array on the stack).


 But given that it's possible to pass references, it should be
 possible to pass references to C arrays when the C funtion is coded
 as if it expects an array (when, of course, it really expects a
 reference).

Right, this works assuming sane C, and IIRC, with small arrays it can
expect the whole array to be on the stack.  (But maybe the rules for
structs are the same, so it works out by size only.)

-- 
  ((lambda (x) (x x)) (lambda (x) (x x)))  Eli Barzilay:
http://barzilay.org/   Maze is Life!
_
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev


Re: [racket-dev] [racket] newbie: foreign C structure definition question

2010-11-18 Thread Hendrik Boom
On Thu, Nov 18, 2010 at 10:06:34PM -0500, Eli Barzilay wrote:
 [redirected to dev again]
 
 15 minutes ago, Hendrik Boom wrote:
  On Tue, Nov 16, 2010 at 11:37:17PM -0500, Eli Barzilay wrote:
   Three minutes ago, Jay McCarthy wrote:
We could use a syntax parameter in define-cstruct to communicate to
the vector syntax to give them the correct size in structs and make
my macro's approach the normal behavior.
   
   * Types in a cstruct are plain expressions (that should evaluate to
 ctype values).
   
   * Arrays should be available as a type outside of cstructs too.
  
  An array of, say, ten elements should be passes the same way as a
  struct with the same ten elements.
 
 Yes, what I said earlier is that it really boils down to being able to
 define a libffi type descriptor with some manually specified size and
 alignment.  It's also how the current hackarounds all work.
 
 
  That C doesn't do this is a flaw in its calling interface.
 
 And that actually is another problem for Sam when he implements this
 -- dealing with whatever situations make C expect the array to be
 passed by value (a real one, with the whole array on the stack).
 
 
  But given that it's possible to pass references, it should be
  possible to pass references to C arrays when the C funtion is coded
  as if it expects an array (when, of course, it really expects a
  reference).
 
 Right, this works assuming sane C, and IIRC, with small arrays it can
 expect the whole array to be on the stack.  (But maybe the rules for
 structs are the same, so it works out by size only.)

C defines that when an array is the actual parameter, the address of it 
is passed instead.  It depends on the fact that the type of the 
argunment is an array and nothing else.  If you pass a one-element array 
of integer (note the singular), you're supposed to get its address 
instead of the array itself.

Structures are passed in their entirety.

Of course, some compilers when functions with prototypes are called, may 
do incredibly convoluted things instead to attain greater efficiency.  
FFI would presumably have to match that complexity in terms of hardware 
register hacking.

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