[racket] Bytes and GC

2014-01-25 Thread Roman Klochkov
> (define a #"abcd") > (define a0 (cast (cast a _bytes _pointer) _pointer _bytes)) > (eq? a a0) #f > (bytes-set! a0 2 33) > a #"ab!d" > (immutable? a) #t So I have two different objects with the same pointer. Will garbage collector work correct in this situation? I mean, it should see two refe

Re: [racket] Racket v5.92

2014-01-25 Thread Robby Findler
We hope to release 6.0 in a short amount of time if 5.92 goes okay. We wanted time for a slightly wider circle to try things out before the big 6-oh. Robby On Sat, Jan 25, 2014 at 9:52 PM, Juan Francisco Cantero Hurtado < i...@juanfra.info> wrote: > Thanks for the work on the new version :D > >

Re: [racket] Racket v5.92

2014-01-25 Thread Juan Francisco Cantero Hurtado
Thanks for the work on the new version :D I'm using the "builtpkgs" tarball. Everything works OK. The only problem is PLT_SETUP_OPTIONS="-j 2" breaks the "make install" step. Just a question. Why "5.92"? Why not "6"?. On 01/25/14 18:55, Ryan Culpepper wrote: Racket 5.92 has a new package sys

[racket] adding an s-exp-format to plai-typed?

2014-01-25 Thread John Clements
I want some way to transform an arbitrary s-expression to a string, for use in error messages in plai-typed. This is easy to add (I think I've done it locally), but I thought I'd ask before submitting a pull request. Does this seem like a reasonable feature and/or name? Am I missing an obvious

Re: [racket] selectively local-expand sub-expressions

2014-01-25 Thread Carl Eastlund
Scott, I see what you're doing now. You're not actually trying to use macro expansion at all; you're just using local-expand to substitute the definition of pred? where it occurs, so that you can make its macro definition also serve as its DSL definition. That's sensible, but local-expand is sti

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Greg Hendershott
Thank you for the great explanation. Requiring #:transparent is fine for my purposes. Although the fact that structs can't be equal? without #:transparent is surprising to newcomers (at least it was surprising to me), that's how structs work in Racket. My goal is to make "egal?" behave like equal

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Carl Eastlund
Yes, #:transparent means "reflective tools like struct? and struct-info can see inside it". Otherwise, the short answer is they can't. If you want to be able to tell things like immutability via dynamic tests, you have to use #:transparent for everything. It also controls how equal? works, among

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Greg Hendershott
> skipped? = #t can only arise if some struct type in the hierarchy is opaque, > which would mean struct? returns #f. If you only care about types that > satisfy struct?, you should be able to safely ignore skipped?, if I > understand it correctly. Opaque here means, not declared with #:transpare

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Carl Eastlund
skipped? = #t can only arise if some struct type in the hierarchy is opaque, which would mean struct? returns #f. If you only care about types that satisfy struct?, you should be able to safely ignore skipped?, if I understand it correctly. Carl Eastlund On Sat, Jan 25, 2014 at 6:07 PM, Greg He

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Greg Hendershott
> flaw: If an immutable struct is derived from a mutable one, my > predicate will (as written) incorrectly report it as immutable. > Instead I need to walk the chain of super-types, and check that all > are immutable. I'll work on this more... Here's where I ended up for now. Although I don't und

Re: [racket] Racket v5.92

2014-01-25 Thread Neil Van Dyke
Erich Rast wrote at 01/25/2014 01:36 PM: Is there a roadmap about Planet support, i.e. when will existing Planet packages cease to work? As another Racket user, I'm fairly confident that a PLaneT server and "require" forms will remain around for a long time. (Worst case, if PLT ever got

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Greg Hendershott
I'd mistakenly replied off-list, before re-posting here. Carl you'd pointed out, off-list: > I believe that's right. I haven't ever done this or tested its accuracy, so > you might want to double check that there aren't weird corner cases of the > struct hierarchy, or at least that it works for

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Greg Hendershott
> You can use struct-info and struct-type-info to get at that information, > though it's a bit indirect -- you have to add together the numbers of > initialized and automatic fields, and compare that to the length of the list > of immutable field indices. Thanks! So IIUC that would be the followi

Re: [racket] `immutable?` for `struct`s?

2014-01-25 Thread Carl Eastlund
Greg, You can use struct-info and struct-type-info to get at that information, though it's a bit indirect -- you have to add together the numbers of initialized and automatic fields, and compare that to the length of the list of immutable field indices. The reflective interface to structs is a bi

[racket] `immutable?` for `struct`s?

2014-01-25 Thread Greg Hendershott
I understand that, as its documentation clearly says, `immutable?` is not implemented for `struct`s. (In the sense that structs aren't on its special list: immutable? returns #f even for a struct that does not use #:mutable.) Is there some other way to check at runtime whether something that is st

Re: [racket] make-sized-byte-string and GC

2014-01-25 Thread Roman Klochkov
So, to make string, that is freed by reciever, I should make something like (define _string/transfer        (make-ctype _bytes                         (λ (v)                            (define b (if (string? v) (string->bytes/utf-8 v) v))                           (define length (bytes-length

Re: [racket] Racket v5.92

2014-01-25 Thread Robby Findler
We don't plan to improve or otherwise change any of the planet packages, but we do plan to maintain backwards compatibility so that future versions of racket will continue to run that code as well as it has been doing. Robby On Sat, Jan 25, 2014 at 12:36 PM, Erich Rast wrote: > Fantastic! Con

Re: [racket] make-sized-byte-string and GC

2014-01-25 Thread Ryan Culpepper
On 01/25/2014 01:28 PM, Roman Klochkov wrote: Is making bytestring from pointer adds the pointer to GC?  > (define x (malloc 'raw 10)) > x # > (define b (make-sized-byte-string x 10)) > (cpointer-gcable? b) #t > (cpointer-gcable? x) #f > (cast x _pointer _int32) 173726656 > (cast b _poin

Re: [racket] Racket v5.92

2014-01-25 Thread Erich Rast
Fantastic! Congratulations! One more question about the new package system: Is there a roadmap about Planet support, i.e. when will existing Planet packages cease to work? "foreseeable future" is a bit vague. I'm developing very slowly due to lack of spare-time and have a mid-size application wi

[racket] make-sized-byte-string and GC

2014-01-25 Thread Roman Klochkov
Is making bytestring from pointer adds the pointer to GC?  > (define x (malloc 'raw 10)) > x # > (define b (make-sized-byte-string x 10)) > (cpointer-gcable? b) #t > (cpointer-gcable? x) #f > (cast x _pointer _int32) 173726656 > (cast b _pointer _int32) 173726656 So b and x points to the same bl

[racket] Racket v5.92

2014-01-25 Thread Ryan Culpepper
Racket 5.92 has a new package system, including a catalog of hundreds of already-available packages. Please visit http://pkgs.racket-lang.org/ for an overview of the packages. Recent releases included the "beta" versions of the package system. Racket version 5.92 incorporates many improvement