Re: [racket-dev] strange top-level binding for module-defined identifiers

2014-07-24 Thread Matthew Flatt
I'll push a repair. The problem is in the representation of syntax objects and the flaky way that it was generalized to support identifiers that move across submodule boundaries (but the problem didn't just affect programs with submodules, in this case). At Thu, 24 Jul 2014 16:24:42 -0400, Sam To

Re: [racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Robby Findler
Yes, true! Robby On Thu, Jul 24, 2014 at 8:07 PM, Sam Tobin-Hochstadt wrote: > Struct chaperones are the important part, I think. > > But the theorem would be false under option 1, I think. Adding contracts can > add non-contract errors -- the error you get when a you supply the wrong > accessor

Re: [racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Sam Tobin-Hochstadt
Struct chaperones are the important part, I think. But the theorem would be false under option 1, I think. Adding contracts can add non-contract errors -- the error you get when a you supply the wrong accessor for struct-chaperone. Sam On Jul 24, 2014 7:54 PM, "Robby Findler" wrote: > Ah, nope.

Re: [racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Robby Findler
Ah, nope. That model doesn't include function chaperones! Robby On Thu, Jul 24, 2014 at 6:14 PM, Robby Findler wrote: > I also lean towards #2. What does the redex model say? Most of those > pieces are in it, I think. > > Robby > > On Thu, Jul 24, 2014 at 3:25 PM, Matthew Flatt wrote: >> Nice e

Re: [racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Robby Findler
I also lean towards #2. What does the redex model say? Most of those pieces are in it, I think. Robby On Thu, Jul 24, 2014 at 3:25 PM, Matthew Flatt wrote: > Nice example. Offhand, I think that #2 is right, but I'll have to look > at it more to be sure. > > At Thu, 24 Jul 2014 15:45:18 -0400, Sa

Re: [racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Sam Tobin-Hochstadt
Thinking about it more, I think it has to be #2, since otherwise: (module m1 racket (struct x (a)) (provide (contract-out (struct x ([a integer?] (module m2 racket (require 'm1) (provide (contract-out (struct x ([a even?] won't work, which seems like something that should be supp

Re: [racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Matthew Flatt
Nice example. Offhand, I think that #2 is right, but I'll have to look at it more to be sure. At Thu, 24 Jul 2014 15:45:18 -0400, Sam Tobin-Hochstadt wrote: > Consider the following module: > > (module m racket > (struct x [a]) > (define v1 (x 'secret)) > (define v2 (x 'public)) > (provid

Re: [racket-dev] strange top-level binding for module-defined identifiers

2014-07-24 Thread Sam Tobin-Hochstadt
Ok, here's a much simpler example: #lang racket (module foo racket (provide def-wrap) (define-syntax-rule (def-wrap) (begin (define y 1) y))) (module bar racket (require (submod ".." foo)) (def-wrap)) In the fully-expanded syntax, the macro stepper suggests that `y` has no apparent

[racket-dev] strange top-level binding for module-defined identifiers

2014-07-24 Thread Sam Tobin-Hochstadt
If you take this program (which is a lot like the implementation of `racket/fixnum`): #lang racket/base (require '#%flfxnum racket/private/vector-wraps racket/unsafe/ops (for-syntax racket/base)) (define-vector-wraps "fxvector" "fixnum?" fixnum? fxvector? fxvector-

[racket-dev] A tricky chaperone puzzle

2014-07-24 Thread Sam Tobin-Hochstadt
Consider the following module: (module m racket (struct x [a]) (define v1 (x 'secret)) (define v2 (x 'public)) (provide v1 v2) (provide/contract [x-a (-> x? (not/c 'secret))])) It appears that this ensures that you can't get 'secret. But, it turns out that I can write a function outside

Re: [racket-dev] Racket hash tables vs. Python dicts - Performance

2014-07-24 Thread Matthew Flatt
Well, I couldn't leave this alone --- especially after I realized that some of the dispatching overhead has to do with C functions that cooperate specially with the GC for more complex cases. I've streamlined various paths and cut about 1/3 of Racket's time on the example. At Thu, 24 Jul 2014 11:

Re: [racket-dev] Racket hash tables vs. Python dicts - Performance

2014-07-24 Thread Matthew Flatt
In Racket, it looks like a lot of the time is still in generic dispatch: directing hash operations to `equal?`-based hashing, directing `equal?`-based hashing operation to the string-specific operation, directing equality comparison to string-specific equality comparison, and so on. I'm not sure i

Re: [racket-dev] Racket hash tables vs. Python dicts - Performance

2014-07-24 Thread Robby Findler
Not an answer to your direction question, but this is the more idiomatic way to write that and it seems to be a bit faster: (time (for ([w (in-list words)]) (hash-set! d w (add1 (hash-ref d w 0) On Wed, Jul 23, 2014 at 10:54 AM, Pedro Ramos wrote: > Hi, > > I've been developing an im

[racket-dev] Racket hash tables vs. Python dicts - Performance

2014-07-24 Thread Pedro Ramos
Hi, I've been developing an implementation of Python in Racket, where I'm implementing Python's dictionaries over Racket custom hash tables. While my occasional benchmarks typically show better performance on Racket programs than their Python equivalents, Racket's hash tables generally seem to be