Why Types?

new topic     » topic index » view thread      » older message » newer message

Can Euphoria be a scripting or shorthand lanaguage?
consider this;
 in EUPHORIA;
 integer s
s=rand(100)

in QBasic;
a%  = INT(RND * 100)

In this dummy Qbasic statement %A = int(RND) , %A is an integer type yet
we still had to declare the value of (RND) as an INT type , duh...
(some BASIC will let you do "%A=5" but others make you "defTYPE")

Before you can use a variable most "languages"
 Require/Demand that you;
  1. declare the type
  2. assign a value
For short hand  or scripting language this is
just not needed.

 in JAVAscript;
 VAR  D="yes"    ;   assigns VALUE and indirectly declares TYPE

To make Euphoria "user friendly" why not "ASSUME object"

>From what I see ( I am very new to euphoria) anything that is a sequence
can be an integer or string...?big question mark
if I change
 integer s          to ;   sequence s
  s=65                   ;   s=65                 --doe it not work?

No it does not ,  I get ;  type_check failure, s is 65'A'
if I attempt a 1 element array  or sequence will it work?
s=(65)
puts(1,s[1])  ; No again, it will not . ok try object?

object s
s=65
yes it works  ie.. "? S"-outputs 65 and "puts(1,s)" outputs A

Can it handle "any" arbritary assignment?
s=a65       no
s=(A 65)    no
s=("A" 65) no
s can not be both 65 and A in Euphoria?
( I think the manual says that too, atoms are numeric only)

You should be able to declare TYPE and METHOD in the way
You choose to implement it .. ie s=A and 65  then s=65 for numeric
expressiona and s= A for text expression. Is this "forward referencing?"
if A=900  not a printable charactor ,then I could understand.
I would expect Ex.err to say  "s TYPE 900 is invalid TEXT", but only
if I attempt to "use" it as TEXT.

Its at this point I entered "point" into GURU (very handy ! )
but all I get is mouse pointer and c_pointer info but there is one mention
under
"performance" about euphoria using pointers in sequence type structures...
but from the reference manual I get;
 "Euphoria does not have pointers and does not need them." ? blink blink

I kinda like the fact that a number can be a value OR the pointer to a
value,
I even like assembly's 0100h or [0100h].

Can I PEEK a pointer? i = peek(A) .A is a linear address or seg:reg type?
I just have a problem with basic's use of peek , maybe this one is better.
Anyone upto speed on using peek ? help... (yet another learning curve)

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu