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

Re: Types in Cor (and Perl)

Thread Previous | Thread Next
Ovid via perl5-porters
July 13, 2020 15:18
Re: Types in Cor (and Perl)
Message ID:
First, thanks to those who've taken the time to correct some of my misunderstandings.
> So commenting Ovid's Dollar/Euro example:> - Num is primitive type
> - Dollar/Euro are non-primitive types
If we make a distinction, I think the terminology could be improved to help clarify the meaning. Maybe "built-in" versus "derived"? If we can pick terminology which is self-defining, I think fewer misconceptions might occur.

-- IT consulting, training, specializing in Perl, databases, and agile development 
Buy my book! - 

    On Monday, 13 July 2020, 16:30:03 CEST, Branislav Zahradník <> wrote:  

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 LimitConstraint 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