[racket] splicing internal define?

From: Marijn (hkBst at gentoo.org)
Date: Thu Sep 29 05:57:55 EDT 2011

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/28/11 17:45, Neil Van Dyke wrote:
> Sam Tobin-Hochstadt wrote at 09/28/2011 10:42 AM:
>> (require racket/mpair racket/splicing)
> 
> I guess the advantage of "let-splicing" here is that you can put
> the names by the definitions

That's certainly what I like it for.

> Incidentally, Marijn, given that that's a module right there, I
> suspect that the main reason you want to hide "value-store" like
> this is if this code was actually the result of a macro expansion.

This code is the result of macro expansion, local to the code produced
by the macro and because the macro is looking to become rather large,
I wanted to hide the implementation of value-store from the local uses
as well. The current alist implementation is certainly suboptimal and
I'm looking to replace it with a vector later, because random access
is the most common (only?) operation I need, but right now an alist is
fine.

> If not as the result of a macro expansion, then a perfectly normal
> practice is to use a top-level binding and simply not export it
> from the module

Thanks, I hadn't even thought of that.

> If you were writing a reusable library rather than experimenting

It doesn't look like this value-store is going to be much more
complicated than it currently is, so I currently don't see it growing
into a library.

> There's also a good chance you'd also use something other than
> mutable pairs, too, such as hashes or non-mutable pairs.  You'll
> see examples in old Scheme textbooks of rolling your own records or
> objects using pairs, and that's good for learning, but for most
> real-world development, Racket has a large library of often better
> ways to accomplish things.

If you're saying all of this to convince me to not use an alist, then
you are being extremely polite about it.

Thanks for your help, Neil!

Marijn

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6EQSMACgkQp/VmCx0OL2xygACgjr7L/MUWqc5SVv7wlZOSwxLl
Fr8An3CVBqav6COJU5ehMU7Sctsk3Il6
=8gdW
-----END PGP SIGNATURE-----


Posted on the users mailing list.