Implementation of paraeters

瀏覽次數:15 次
跳到第一則未讀訊息

Hendrik Boom

未讀,
2020年3月2日 中午12:45:022020/3/2
收件者: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

未讀,
2020年3月2日 下午1:36:022020/3/2
收件者: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.
回覆所有人
回覆作者
轉寄
0 則新訊息