1. [docs and wiki] How many data-types do we emphasize?
- Posted by _tom (admin) Jan 29, 2021
- 1273 views
- How many data-types do we want to emphasize?
- 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
- 4 categories
- 8 kinds of integer
- 4 kinds of float
- 5 misc numeric types
- 9 derived types
be well
_tom
2. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by irv Jan 29, 2021
- 1224 views
Five - the string type is super handy. Diagram 5.2 is clearest to me.
3. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by euphoric (admin) Jan 29, 2021
- 1221 views
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.
4. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by euphoric (admin) Jan 29, 2021
- 1201 views
[quote euphoric]
Wait! User-defined types!
six
object|number|integer|sequence|string|user-defined
5. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by irv Jan 29, 2021
- 1196 views
Yes - but user-defined types can fall under / be an offshoot of any of the 5, so it's hard to diagram them.
6. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by petelomax Jan 30, 2021
- 1226 views
Go has many
https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types
7. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by _tom (admin) Jan 30, 2021
- 1196 views
The giveaway is the warning at the top of the page "19 minutes to read".
_tom
8. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by _tom (admin) Jan 30, 2021
- 1175 views
┌────────┠┌─┤ object ├─┠Five built-in Types │ └────────┘ │ │ │ number sequence │ │ integer string └────────────┬───────────┘ Compose as needed │ user-defined
be well
_tom
9. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by irv Jan 30, 2021
- 1213 views
The giveaway is the warning at the top of the page "19 minutes to read".
_tom
Need to add "A lifetime to understand"
10. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by ghaberek (admin) Jan 30, 2021
- 1173 views
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
11. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by petelomax Jan 30, 2021
- 1171 views
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...
or...
To be fair, they do make code nicer to read, just very very very difficult to properly understand translate to assembly
12. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by katsmeow Jan 30, 2021
- 1149 views
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
13. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by irv Jan 30, 2021
- 1152 views
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.
14. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by kinz Jan 31, 2021
- 1137 views
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
15. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by irv Jan 31, 2021
- 1096 views
┌────────┠┌─┤ 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
16. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by _tom (admin) Jan 31, 2021
- 1093 views
[quote irv]
┌────────┠┌─┤ 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
17. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by katsmeow Jan 31, 2021
- 1110 views
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
18. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by petelomax Jan 31, 2021
- 1086 views
[deleted]
19. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by katsmeow Jan 31, 2021
- 1090 views
[deleted]
Pete, can we get some meta-data about your deleted posts, to have some context?
Kat
20. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by kinz Feb 01, 2021
- 1091 views
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
21. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by _tom (admin) Feb 01, 2021
- 1061 views
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
22. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by irv Feb 01, 2021
- 1055 views
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]
23. Re: [docs and wiki] How many data-types do we emphasize?
- Posted by _tom (admin) Feb 01, 2021
- 1064 views
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