Reputation: 71
I just discovered Chapel's config variable modifier which is great for command line operations. Are there other languages or frameworks that mimic this feature so I don't have to program the filters each time?
Upvotes: 3
Views: 108
Reputation: 1
config
-s is indeed unparalleled:config var VAR = 1; // --VAR=10 sets other value from cmdline
// --VAR 20 sets other value too
config const RHO = 1.23456; // --RHO=0.123456 sets other value from cmdline
// --RHO 0.2468 sets other value too
// --RHO=0.39*VAR sets other value for COMPILER
// based on VAR
config param DBG = false; // -s DBG=true sets other value from cmdline
config type B = uint(8); // -sB='uint(16)' sets other value from cmdline
// -sB='if DBG then uint(32) else uint(16)'
// sets other value for COMPILER
// based on DBG
While there is yet a must to have a compile-time known typing, which is a certain restriction ( for strong-typed, compiled languages both obvious and natural ), still the flexibility of use of these constructs for ad-hoc setup of an adaptive run-time configurable behaviour is great and hard to parallel in other language / compiler environments.
Upvotes: 2