develooper Front page | perl.perl5.porters | Postings from July 2020

Re: Types in Cor (and Perl)

Thread Previous | Thread Next
July 13, 2020 14:29
Re: Types in Cor (and Perl)
Message ID:
I see types and constraints are fundamentally one and the same thing.
> A type is fundamentally just a set of values, such as the set of integer
> values
> or the set of array values or the set of all values.
example (I found such code in java codebase):
class Limit { ... enforces min/max 0/1000 }

class Foo extends Limit { Foo (int i) { super (i/3) } }

Type check: Foo is a Limit
Constraint check: Foo is not a Limit (only 1/3)

> Primitives and strong types are very frequently used.
> The whole concept of primitive types is mostly arbitrary.  For example, is
> a
> character string a primitive type or is it an array of characters?
Strong types are not tied to primitive types, they are very separate
> concepts.
Fair point. So let me define what I understand as a primitive type:
- primitive type defines a storage class of data (I/O serialization)
- non-primitive type defines meaning of data.

Under strong types concept I do understand the strong definition of meaning
of data.

So commenting Ovid's Dollar/Euro example:
- Num is primitive type
- Dollar/Euro are non-primitive types

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About