1. [docs and wiki] How many data-types do we emphasize?

  1. How many data-types do we want to emphasize?
  2. What is the best graphic to illustrate?

one

object does everything

kind of like those languages that do not declare the data-type of a variable

(Fancy graphics can come later.)

┌ object ┐ 
└────────┘ 

two

I like the concept of two distinct data-types

atom|integer|(number) == one number

sequence|(string) == a list of values

Ultimately, a lot of design choices in programming come down to choosing between two fundamental choices.

┌───── object───────┐ 
| number | sequence | 
└───────────────────┘ 
 
    object 
---------------- 
|              | 
number         sequence 
 
 
        object 
         /\ 
        /  \ 
  number    sequence 

three

Classic object|atom|sequence

just to realize that the object data-type comes in handy

five

object|number|integer|sequence|string

Phix has five.

┌───── object───────┐ 
│ number │ sequence │ 
│   │    │   │      │ 
│ integer│ string   │ 
└───────────────────┘ 
 
    object 
---------------- 
|              | 
number         sequence 
     |                | 
     integer          string 
 
        object 
         /\ 
        /  \ 
  number    sequence 
       |           | 
     integer      string 
 

Go has many

https://www.tutorialspoint.com/go/go_data_types.htm

  • 4 categories
  • 8 kinds of integer
  • 4 kinds of float
  • 5 misc numeric types
  • 9 derived types

be well
_tom

new topic     » topic index » view message » categorize

2. Re: [docs and wiki] How many data-types do we emphasize?

Five - the string type is super handy. Diagram 5.2 is clearest to me.

new topic     » goto parent     » topic index » view message » categorize

3. Re: [docs and wiki] How many data-types do we emphasize?

_tom said...

five

object|number|integer|sequence|string

Phix has five.

┌───── object───────┐ 
│ number │ sequence │ 
│   │    │   │      │ 
│ integer│ string   │ 
└───────────────────┘ 
 
    object 
---------------- 
|              | 
number         sequence 
     |                | 
     integer          string 
 
        object 
         /\ 
        /  \ 
  number    sequence 
       |           | 
     integer      string 
 

This is a good question. At first, I'm like, the classical three. Start with the atom. Tell them you can group atoms in sequences. And objects are an umbrella term for any and all types.

However, I like the option for five because Phix actually has functionality that deals with the string type.

I think the 5 types is the best option.

new topic     » goto parent     » topic index » view message » categorize

4. Re: [docs and wiki] How many data-types do we emphasize?

[quote euphoric]

_tom said...

five

object|number|integer|sequence|string

Wait! User-defined types!

six

object|number|integer|sequence|string|user-defined

new topic     » goto parent     » topic index » view message » categorize

5. Re: [docs and wiki] How many data-types do we emphasize?

euphoric said...

Wait! User-defined types!

six

object|number|integer|sequence|string|user-defined

Yes - but user-defined types can fall under / be an offshoot of any of the 5, so it's hard to diagram them.

new topic     » goto parent     » topic index » view message » categorize

6. Re: [docs and wiki] How many data-types do we emphasize?

http://phix.x10.mx/five_types.png

_tom said...

Go has many

https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

new topic     » goto parent     » topic index » view message » categorize

7. Re: [docs and wiki] How many data-types do we emphasize?

The giveaway is the warning at the top of the page "19 minutes to read".

_tom

new topic     » goto parent     » topic index » view message » categorize

8. Re: [docs and wiki] How many data-types do we emphasize?

 
            ┌────────┐ 
          ┌─┤ object ├─┐        Five built-in Types 
          │ └────────┘ │ 
          │            │ 
        number     sequence 
          │            │ 
        integer      string 
 
    └────────────┬───────────┘  Compose as needed 
                 │ 
            user-defined 
 

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

9. Re: [docs and wiki] How many data-types do we emphasize?

_tom said...

The giveaway is the warning at the top of the page "19 minutes to read".

_tom

Need to add "A lifetime to understand"

new topic     » goto parent     » topic index » view message » categorize

10. Re: [docs and wiki] How many data-types do we emphasize?

irv said...
_tom said...

The giveaway is the warning at the top of the page "19 minutes to read".

_tom

Need to add "A lifetime to understand"

To be fair, most of the classic WINAPI data types are just Microsoft's names for C data types, and everything else is a pointer-sized unsigned integer.

-Greg

new topic     » goto parent     » topic index » view message » categorize

11. Re: [docs and wiki] How many data-types do we emphasize?

ghaberek said...

To be fair, most of the classic WINAPI data types are just Microsoft's names for C data types, and everything else is a pointer-sized unsigned integer.

To be fair, you either get 'em all exactly spot on correct... or your program either don't compile or don't work... blink

or...

To be fair, they do make code nicer to read, just very very very difficult to properly understand translate to assembly getlost

new topic     » goto parent     » topic index » view message » categorize

12. Re: [docs and wiki] How many data-types do we emphasize?


I'd like to stress the user type, the way OE implements it now.

1) it's faithfully called on every assignment

2) it's programmable!!!

3) there seems to be no limit to how many unique types there are in a program or include

Kat

new topic     » goto parent     » topic index » view message » categorize

13. Re: [docs and wiki] How many data-types do we emphasize?

katsmeow said...


I'd like to stress the user type, the way OE implements it now.

1) it's faithfully called on every assignment

2) it's programmable!!!

3) there seems to be no limit to how many unique types there are in a program or include

Kat

Thanks Kat:

As you point out, it also goes beyond just enforcing a type. I find this sort of thing helpful:

-------------------------------  
global type db_err(object x) -- trap eds errors in db procedures;  
-------------------------------  
if x != DB_OK then -- show popup message as well as in the terminal (if used): 
    display("Database Error: [] [] []",{x,decode_err(x),get("input_entry.text")})  
    Error("MainWin",format("Database error code []",x),  
        format("DB: []",{get("input_entry.text")}), -- db name user entered;  
        format("[]",{decode_err(x)}),GTK_BUTTONS_OK) -- from db error table; 
    return 1  
end if  
return x = DB_OK  
end type  
 
db_err x = db_open("bad.edb") -- open, or issue warning, no crash. 
 

Nearly identical routines can create tbl_err and rec_err types, to handle calls such as db_create_table, db_select_table, db_insert, etc.

new topic     » goto parent     » topic index » view message » categorize

14. Re: [docs and wiki] How many data-types do we emphasize?

katsmeow said...


I'd like to stress the user type, the way OE implements it now.

1) it's faithfully called on every assignment
2) it's programmable!!!
3) there seems to be no limit to how many unique types there are in a program or include

Kat, that user type is one of the main EUPHORIA features,
so OE is just compatible with standard RDS EU on this matter.
The registered users of EU1.0...2.5 all are very glad to see
this feature of their old good RobC's language, which they got
along with printed manual, 01 FD and best wishes from Junco in 1993.
27 years, RDS rules!

Regards


kinz

new topic     » goto parent     » topic index » view message » categorize

15. Re: [docs and wiki] How many data-types do we emphasize?

_tom said...

 
            ┌────────┐ 
          ┌─┤ object ├─┐        Five built-in Types 
          │ └────────┘ │ 
          │            │ 
        number     sequence 
          │            │ 
        integer      string 
 
    └────────────┬───────────┘   
                 │ 
    Any of these types can be further 
    restricted / limited by declaring 
    a user-defined type.  
 

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

16. Re: [docs and wiki] How many data-types do we emphasize?

[quote irv]

_tom said...

 
            ┌────────┐ 
          ┌─┤ object ├─┐        Five built-in Types 
          │ └────────┘ │ 
          │            │ 
        number     sequence 
          │            │ 
        integer      string 
 
    └────────────┬───────────┘   
                 │ 
               type            A user defined 'type' 
                               further limits permitted values 
                    
 

be well
_tom

Irv has captured the ''essence'' of what a data-type is; compared to:

wikipedia: "''This data type defines the operations that can be done on the data, the meaning of the data, and the way values of that type can be stored.'''


A data-type "restricts the permitted values of a variable."

(I know this is true because I wrote this down a while back...)


The conventional view of operations, meaning, and storage do not apply.

An expression may compute to a real value; but you can't assign that value to an integer. Euphoria never constrained how you write an expression, what the result was, and what you can do with your result--only you better assign an integer to an integer variable.

A ""data-type"" in Euphoria/Phix is a different animal from a conventional beast.

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

17. Re: [docs and wiki] How many data-types do we emphasize?

kinz said...
katsmeow said...


I'd like to stress the user type, the way OE implements it now.

Kat, that user type is one of the main EUPHORIA features,

kinz

Ok, sorry i mentioned it, i withdraw my opinion.

Kat

new topic     » goto parent     » topic index » view message » categorize

18. Re: [docs and wiki] How many data-types do we emphasize?

[deleted]

new topic     » goto parent     » topic index » view message » categorize

19. Re: [docs and wiki] How many data-types do we emphasize?

petelomax said...

[deleted]

Pete, can we get some meta-data about your deleted posts, to have some context?

Kat

new topic     » goto parent     » topic index » view message » categorize

20. Re: [docs and wiki] How many data-types do we emphasize?

_tom said...

five

object|number|integer|sequence|string

Phix has five.

Tom, I like:
"thing" instead of "object" -> any of these below
"the" instead of "atom" or "number" -> single numeral of any value
"set" instead of "sequence" -> 0 or more numerals or sets of any value
"int" instead of "integer" -> yes, old good single integer, for short.

"string" must to be something separate user defined :
ANSY, ASCII, UTF8, UTF16, UNICODE, ISO, KOI8R, KOI8U ...
just road to hell.
RDS had big problems with these thingies in 1.* series.

And we can have these very handy types just now in standard EU.
I already have a secret nanolib for my internal works on 3.2ru.

Regards


kinz

new topic     » goto parent     » topic index » view message » categorize

21. Re: [docs and wiki] How many data-types do we emphasize?

Messing with names is always a problem:

Euphoria Phix
object object thing
atom number/atom the
integer integer int
sequence sequence set
string
"string"
type type
  • renaming "atom" to "number" makes beginner tutorials easier to understand (you have to explain what "atom" is)
  • probably you could rename "object" to "value"
    • "object" conflicts with how OOP people use the word (this can not get fixed)
    • "thing" "entity" sound like OOP terms
  • "number" is descriptive, "the" is not
  • "set" suggests a collection of unique items mathematically, no order
    • "sequence" means "an ordered collection"; that's what it is
    • "list" (aka Lisp) could have worked instead of "sequence"
  • "int", is that short for "interior decorating"?
    • "integer" is more descriptive
  • "string" corresponds to UTF8, the internet, and beyond
    • for specific languages, you are stuck defining your own
  • "type" is the unsold super feature of Euphoria|Phix

Out of all this I would suggest that "value" be a synonym for "object"

  • original Euphoria docs talk about "working with values...simplification"
  • OOP people think they own the word "object" and get confused
  • easier to document and explain

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

22. Re: [docs and wiki] How many data-types do we emphasize?

_tom said...

Messing with names is always a problem:


Out of all this I would suggest that "value" be a synonym for "object"

  • original Euphoria docs talk about "working with values...simplification"
  • OOP people think they own the word "object" and get confused
  • easier to document and explain
  • No, "value" clearly refers to something numeric. Dictionary.com says "worth, merit, or importance". This is a sentence. What is the worth, value, or importance of the 2nd word in that sentence? 1,2,3,4 What is the value of the third number in that series? Bet you can answer the second question, but not the first.
  • True. OOP users have effectively captured the word "object" for their own use. However, there may not be any suitable alternative.
  • Without a more meaningful alternative, do what you can and hope that people aren't too stupid to read and understand the difference.

(Note that many colleges now offer "remedial reading" and "basic math" courses for things that people should have learned by second grade. So don't count too much on that last suggestion actually working.)

be well
_tom

[/quote]

new topic     » goto parent     » topic index » view message » categorize

23. Re: [docs and wiki] How many data-types do we emphasize?

Sorry Igor, looks like a case of "butterfly effect", a small idea that looks good at first can really mess up traditional Euphoria.

Phix data-types are now looking more like:

 
            ┌────────┐ 
          ┌─┤ object ├─┐        Five built-in Types 
          │ └────────┘ │ 
          │            │ 
        number     sequence 
          │            │ 
        integer      string 
 
      └──────────┬─────────┘ 
                 │              User-Defined Types 
                type            further limit 
                                permitted values 
 
    └────────────┬───────────┘ 
              struct            Reference data-types 
              class 
 

be well
_tom

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu