From: <apn...@ya...> - 2025-01-30 16:08:44
|
(Probably a question for Donal, but sending to the list in case folks have ideas / opinions for or against) The [const] command implementation in Tcl 9 essentially bars writes to specified variables. How hard would it be to loosen this constraint mechanism to instead only bar certain writes, for example, writing values that do not match a specified type? So, in Tcl 9 const x 42 set x 43 <- disallowed Similarly, Int32 x 42 Set x 43 <- allowed Set x abc <- disallowed Etc. A generalized constraint mechanism will introduce many complexities but just type check does not seem hard to implement. The motivation by the way is to simplify interfaces to external API's in other languages and data exchange by not having to carry typing tags. Any comments on (a) feasibility, and (b) implications, if any, for Tcl semantics ? /Ashok |