Firefox changes, and languages

bearophile bearophileHUGS at lycos.com
Wed Nov 2 05:47:01 PDT 2011


Caligo:

> And then there is Chapel, but I think you already know about it.

I have presented Chapel here few times, but I have only written some small programs with it.


> I like its 'Configs' features, but that's a small one.

This small feature is quickly described at page 12 here:
http://chapel.cray.com/tutorials/SC10/M10-2-Basics.pdf


Syntax:
  config-declaration:
  config type-alias-declaration
  config declaration

Semantics:
  - Like normal, but supports command-line 
  - Must be declared at module/file scope

Examples:
  config param intSize = 32; 
  config type elementType = real(32);
  config const epsilon = 0.01:elementType; 
  config var start = 1:int(intSize);

% chpl myProgram.chpl -sintSize=64 -selementType=real
% a.out --start=2 --epsilon=0.00001

It allows to give at compile-time the values of global constants (even floating point values, and even types) that are tagged with "config", and at run-time the values of global (module-level) variables.

It's handy for the purpose Chapel programs are written, like to to parametrize physics simulation parameters.

In D if you want to change the constants and you don't want to touch the source file modules, you have to write your values in a little text file, that the program "includes" as raw text. This is not handy. So the Configs feature is nice, for certain kinds of programs (D is useful for the same kinds of programs too).

Bye,
bearophile


More information about the Digitalmars-d mailing list