I have had my attention called to
http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/
repeatedly, and perhaps discussions of types are interesting.

J has two systems of types:

J's static type system has nouns, verbs, adverbs and conjunctions (J's
copula might also be thought of as having static type, but copula
cannot be used in isolation so I will not consider them to be a part
of the type system).

J's dynamic type system currently has boolean, literal, integer,
floating point, complex, boxed, extended integer, rational, sparse
boolean, sparse literal, sparse integer, sparse floating point, sparse
complex, sparse boxed, symbol and unicode.  Note that J's gerunds do
not have their own type -- they use the boxed type.

Additionally, J's static type system is extensible in a restricted,
but open ended sense:  Adverbs and Conjunctions can produce any of the
main four static types, and this result is a part of the complete
static type.  In some sense, this is like a macro, or a define-syntax
system, it's constrained -- in essence all you can do here is obtain
additional arguments (beyond the "zero extra arguments" that a noun
result can reference).

J's dynamic type system is not extensible, in current implementations
of J.  This is [arguably, but in my opinion] a good thing.

We could imagine [for example] a facility (analogous to f.) which
transforms a J verb according to some static type inference system
which has its origins in the types supported by J's dynamic type
system.  Here, a constraint on dynamic type within the verb could have
its influence propagated to the beginning of the verb -- if at some
point a value must be a member of a restricted set of types, the verb
could refuse to run if an argument were not a member of an appropriate
set (thus avoiding the need to perform those tests in an iterated
context).  See also: http://www.chilton.com/~jimw/apl85.html

That said, note that a type language is typically a low power language
with guaranteed termination semantics ("grammar"), which allows for
some [necessarily incomplete] early consistency tests on large
programs.  I do not use J to write large programs, so I do not miss
this kind of meta-language in J.  I mostly use J to understand
concepts, and I am usually only interested in concise J expressions.
Some other people's needs will of course be different.

Finally, note that a key feature of J's type system is its regularity,
which is inspired a variety of mathematical issues.  Math, in general,
is not necessarily regular, but a regular

I believe the above description is consistent with typical uses of
these words and phrases.  But note that strictly speaking the types
which I have labeled as "static" are static within an instance of an
expression.  This is unambiguous for tacit expressions, but explicit
expressions are re-parsed during execution in the current
implementation of J.

FYI,

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to