Re: [NTLK] DefConst, DeclareUnit

From: Paul Guyot (pguyot_at_kallisys.net)
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;
>and
> 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:
http://www.unna.org/unna/apple/documentation/developer/QAs-2.x/html/intrpack.htm

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

Paul

-- 
NPDS: http://newton.kallisys.net:8080/
Apache: http://www.kallisys.com/
-- 
This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries
List FAQ/Etiquette/Terms: http://www.newtontalk.net/faq.html
Official Newton FAQ: http://www.chuma.org/newton/faq/


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