Re: [NTLK] DefConst, DeclareUnit

From: Paul Guyot (
Date: Tue Jun 10 2003 - 14:13:12 PDT

Il me semble que le 10/06/03 15:02 -0500, Tom McDougal nous racontait:
>Are DefConst and DeclareUnit documented somewhere? I didn't find
>anything in the usual places.
>What is the difference between
> constant x := 3;
> DefConst('x, 3);
>I'm pretty clear for this simple example you would use the former not
>the latter, but...

The first defines a constant within the current scope with x.
DefConst (a deprecated albeit used by everyone form of
DefineGlobalConstant) defines a global constant (as the newer name
mentions it).

You can put the first form in a function to be executed on a Newton.
You cannot (well, you can, but you'll get an error on the Newton) put
the second form in a such a function since this is a method to be
called at compile time only.

More details:
NewtonScript Reference (constant), NTK User Guide (DefConst).

DeclareUnit is very different. It's to be used with DefineUnit. It's
a way to share NewtonScript objects between packages without using
global variables and with a way to know when the object provider is
present or gets removed.

Documentation is in the Q&As, there:

You might also want to check the sample code (called Moo Unit I think).


This is the NewtonTalk list - for all inquiries
List FAQ/Etiquette/Terms:
Official Newton FAQ:

This archive was generated by hypermail 2.1.5 : Tue Jun 10 2003 - 15:00:01 PDT