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

Re: Types in Cor (and Perl)

Thread Previous | Thread Next
From:
Ovid via perl5-porters
Date:
July 13, 2020 15:18
Subject:
Re: Types in Cor (and Perl)
Message ID:
1176118340.605440.1594653514671@mail.yahoo.com
First, thanks to those who've taken the time to correct some of my misunderstandings.
Second:
> 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.

Best,
Ovid
-- IT consulting, training, specializing in Perl, databases, and agile developmenthttp://www.allaroundtheworld.fr/. 
Buy my book! - http://bit.ly/beginning_perl 

    On Monday, 13 July 2020, 16:30:03 CEST, Branislav Zahradník <happy.barney@gmail.com> 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About