Implementation of paraeters

15 views
Skip to first unread message

Hendrik Boom

unread,
Mar 2, 2020, 12:45:02 PM3/2/20
to Racket Users
How are parameters implemented. My conceptial model is an association
list (like in the original Lisp 1.5 manuel) would suffice, but that can
lead to long searches.

What is actually done in Racket?

-- hendrik

Ryan Culpepper

unread,
Mar 2, 2020, 1:36:02 PM3/2/20
to Racket Users
A parameter object itself is essentially just a key. To get its value, you first look up the current parameterization in the current continuation's continuation-marks. The parameterization contains an immutable eq?-hash mapping parameter keys to thread cells. The parameter's value is the value of the thread cell in the current thread. Setting the parameter mutates the thread cell, but using parameterize with the parameter remaps the parameter to a new thread cell. (Actually, a parameter stores its initial thread cell, so a parameterization's size is limited to the number of distinct parameterized parameters, not the number of all created parameters.)

The Racket CS implementation of parameters is here: https://github.com/racket/racket/blob/master/racket/src/cs/rumble/parameter.ss.

Ryan


--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/20200302174453.7lpltlzivo6iids7%40topoi.pooq.com.
Reply all
Reply to author
Forward
0 new messages