1. structures are possible
------=_NextPart_000_01BE3EE1.5D27B680
I know how to implement structures using Euphoria.
I would like to know others opinion on names for the following routines.
my suggestion: struct()
create_a_struct("customer", {{"name", "age", "sex"},
{"sequence", "integer", "sequence"}})
my suggestion: init_var()
create_a_variable("a_record", "customer")
create_a_variable({"s1", "s2"}, "customer")
my suggestion: assign()
assign_a_value("a_record.name", "Bob Jones")
assign_a_value("a_record.age", 44)
assign_a_value("a_record.sex", "male")
assign_a_value("s1", {"Mary Hyde", 24, "female"})
assign_a_value("s2", {"Sarah Hamill", 36, "female"})
my_suggestion: value_of()
object x, x2
x = get_value_of("s1.age")--x = 24
x2 = get_value_of("s2") --x2 = {"Sarah Hamill", 36, "female"}
my suggestion: del_var()
delete_var("x2")
assign_a_value("x2.name", "Harry")-- an assignment to x2 is now illegal.
--because it has been removed from the variable stack.
--This isn't neccessary for cleanup but it can be used to conserve
--memory when you know that this won't be used again.
_________________________
"I'm good ! Not god." Lucius L. Hilley III - 1998
_________________________
Lucius L. Hilley III lhilley at cdc.net
http://www.cdc.net/~lhilley
http://www.dragonvet.com
_________________________
<IMG SRC="http://www.cdc.net/~ceace/images/lu4.jpg">
_________________________
------=_NextPart_000_01BE3EE1.5D27B680
Content-Transfer-Encoding: quoted-printable
<html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 =
color=3D"#000000" face=3D"Courier New"> I know how to implement =
structures using Euphoria.<br>I would like to know others opinion on =
names for the following routines.<br><br>my suggestion: =
struct()<br>create_a_struct("customer", {{"name", =
"age", =
"sex"},<br> =
bsp; {"sequence", "integer", =
"sequence"}})<br><br>my suggestion: =
init_var()<br>create_a_variable("a_record", =
"customer")<br>create_a_variable({"s1", =
"s2"}, "customer")<br><br>my suggestion: =
assign()<br>assign_a_value("a_record.name", "Bob =
Jones")<br>assign_a_value("a_record.age", =
44)<br>assign_a_value("a_record.sex", =
"male")<br><font face=3D"Arial"><br><font face=3D"Courier =
New">assign_a_value("s1", {"Mary Hyde", 24, =
"female"})<br>assign_a_value("s2", {"Sarah =
Hamill", 36, "female"})<br><br>my_suggestion: =
value_of()<br>object x, x2<br>x =3D get_value_of("s1.age")--x =
=3D 24<br>x2 =3D get_value_of("s2") --x2 =3D =
{"Sarah Hamill", 36, "female"}<br><br>my suggestion: =
me", "Harry")-- an assignment to x2 is now =
illegal.<br>--because it has been removed from the variable =
stack.<br>--This isn't neccessary for cleanup but it can be used to =
conserve<br>--memory when you know that this won't be used =
again.<br>_________________________<br>"I'm good ! Not god." =
Lucius L. Hilley III - 1998<br>_________________________<br><br>Lucius =
L. Hilley III <font =
color=3D"#0000FF"><u>lhilley at cdc.net</u><font =
color=3D"#000000"><br><font =
color=3D"#0000FF"><u>http://www.cdc.net/~lhilley</u><font =
color=3D"#000000"><br><font =
color=3D"#0000FF"><u>http://www.dragonvet.com</u><font =
color=3D"#000000"><br>_________________________<br><IMG =
SRC=3D"<font =
color=3D"#0000FF"><u>http://www.cdc.net/~ceace/images/lu4.jpg</u><font =
------=_NextPart_000_01BE3EE1.5D27B680--
2. structures are possible
Also, Type checking will bill possible using the routines that I
create.
_________________________
"I'm good ! Not god." Lucius L. Hilley III - 1998
_________________________
Lucius L. Hilley III lhilley at cdc.net
http://www.cdc.net/~lhilley
http://www.dragonvet.com
_________________________
<IMG SRC="http://www.cdc.net/~ceace/images/lu4.jpg">
_________________________
3. structures are possible
- Posted by Lucius Hilley <lhilley at CDC.NET>
Jan 13, 1999
-
Last edited Jan 14, 1999
Partial structure code already exist.
I have partially created my struct.e library file. It does not as of yet
handle type_checking.
It also has not yet been speed optimized. The speed optimizing will
require some additional
routines. I fully intend to complete this library. The routine names are
subject to change
according to whatever naming suggestions I recieve. I want these routines
to be fully
accepted by all those that are interested in structures in the programming.
I am trying
to make use of the routines as simple as possible and plan to make the
routines as flexible
as I possibly can. Example: You can assign an entire structure a sequence.
It may not
be speed optimized when finished because of the requirement of
type_checking every
element in the sequence. I am still pondering how to detect whether
type_checking is on
or not. If I am unable to detect I will be force to create additional
routines to instruct the
struct.e library to disable or enable it's type_checking. Default will be
SLOW enabled.
Another example of the flexibilty is you can also recieve an entire
structure.
IE: say you have cat subdivided as cat.name, cat.birthyear, cat.sex
you can retrieve either cat.name seperately or part of the entire cat
structure.
Example:
assign("cat.name", "Fluffy")
assign("cat.birthyear", 1998)
assign("cat.sex", "Female")
Assuming that you initialized cat with a structure of {"name", "birthyear",
"sex"}
you will be able to get the value_of cat in either of two ways.
? value_of("cat.birthyear") -- this prints 1998
or
? value_of("cat") -- this prints {{70,117,102,102,121},1998,
{70,101,109,97,108,101}}
BTW, {70,117,102,102,121} = "Fluffy" and {70,101,109,97,108,101} = "Female"
NOTE: value_of() will not be subject to type_check ing. for obvious
reasons. You are only
getting data. However assign() will be subject to type_check ing. In fact
assign() will be the
only routine that does the type_checking.
CODE is attached Below.
_________________________
"I'm good ! Not god." Lucius L. Hilley III - 1998
_________________________
Lucius L. Hilley III lhilley at cdc.net
http://www.cdc.net/~lhilley
http://www.dragonvet.com
_________________________
<IMG SRC="http://www.cdc.net/~ceace/images/lu4.jpg">
_________________________
begin 600 STRUCT.EX
M/2![?0T*<U]D871A(#T@>WT-"G-?=F%R(#T@>WT-"G-?=F%R7W-T<G5C=" ]
M('M]#0H-"BTM+2UF=6YC=&EO;B B3'5C:75S($PN($AI;&QE>2!)24DB*"D-
M*'-T<G5C='5R92P@<U]N86UE<RD@=&AE;@T*(" @(&US9R ](")!='1E;7!T
M('1O(')E9&5F:6YE('-T<G5C=#H@(B F('-T<G5C='5R92 F(#$P#0H@(" @
M(&5X+F5R<B(-"B @("!M86-H:6YE7W!R;V,H,S<L(&US9RD-"B @(" _(#$O
M, T*("!E;'-E#0H@(" @<U]N86UE<R ](&%P<&5N9"AS7VYA;65S+"!S=')U
M8W1U<F4I#0H@(" @<U]F:65L9',@/2!A<'!E;F0H<U]F:65L9',L(&9I96QD
M<RD-"B @96YD(&EF#0IE;F0@<')O8V5D=7)E#0HM+2TM+2TM+2TM+2TM+2TM
M*0T*("!I;G1E9V5R(&8L(&YA;64L(&9I96QD#0H-"B @9B ](&9I;F0H)RXG
M+"!V87(I#0H@(&EF(&8@=&AE;@T*(" @(&YA;64@/2!F:6YD*'9A<ELQ+BYF
M+3%=+"!S7W9A<BD-"B @("!F:65L9" ](&9I;F0H=F%R6V8K,2XN;&5N9W1H
M*'9A<BE=+"!S7V9I96QD<UMS7W9A<E]S=')U8W1;;F%M95U=*0T*(" @('-?
M9&%T85MN86UE75MF:65L9%T@/2!D871A#0H@(&5L<V4-"B @("!N86UE(#T@
M9FEN9"AV87(L('-?=F%R*0T*(" @('-?9&%T85MN86UE75LQ+BYL96YG=&@H
M;F-E('9A<BD-"B @:6YT96=E<B!F+"!N86UE+"!F:65L9 T*#0H@(&8@/2!F
M:6YD*"<N)RP@=F%R*0T*("!I9B!F('1H96X-"B @("!N86UE(#T@9FEN9"AV
M87);,2XN9BTQ72P@<U]V87(I#0H@(" @9FEE;&0@/2!F:6YD*'9A<EMF*S$N
M"B @("!R971U<FX@<U]D871A6VYA;65=6V9I96QD70T*("!E;'-E#0H@(" @
M;F%M92 ](&9I;F0H=F%R+"!S7W9A<BD-"B @("!R971U<FX@<U]D871A6VYA
M<W1R=6-T=7)E*0T*("!I;G1E9V5R(&8-"B @<V5Q=65N8V4@;7-G#0H-"B @
M:68@9FEN9"AV87(L('-?=F%R*2!T:&5N#0H@(" @;7-G(#T@(D%T=&5M<'0@
M=&\ at <F5D969I;F4 at =F%R.B B("8@=F%R("8@,3 -"B @("!M<V<@/2!M<V<@
M)B B7'0@9F]R(&1E=&%I;&5D(&EN9F]R;6%T:6]N('9I97<@97@N97)R(@T*
M(" @(&UA8VAI;F5?<')O8R@S-RP@;7-G*0T*(" @(#\@,2\P#0H@(&5L<V4-
M"B @("!F(#T@9FEN9"AS=')U8W1U<F4L('-?;F%M97,I#0H@(" @:68@9B ]
M(# @=&AE;@T*(" @(" @;7-G(#T@(E-T<G5C='5R92 B("8@<W1R=6-T=7)E
M("8@(B!N;W0@9&5F:6YE9"XB("8@,3 -"B @(" @(&US9R ](&US9R F(")<
M="!F;W(@9&5T86EL960@:6YF;W)M871I;VX@=FEE=R!E>"YE<G(B#0H@(" @
M("!M86-H:6YE7W!R;V,H,S<L(&US9RD-"B @(" @(#\@,2\P#0H@(" @96YD
M(&EF#0H@(" @<U]V87(@/2!A<'!E;F0H<U]V87(L('9A<BD-"B @("!S7W9A
M92P@<U]N86UE<RDI#0H@(" @<U]D871A(#T@87!P96YD*'-?9&%T82P@<F5P
M96%T*# L(&QE;F=T:"AS7V9I96QD<UMF72DI*0T*("!E;F0@:68-"F5N9"!P
M<BAS97%U96YC92!V87(I#0H@(&EN=&5G97(@9BP@; T*#0H@(&8@/2!F:6YD
M*'9A<BP@<U]V87(I#0H@(&EF(&8@=&AE;@T*(" @(&P@/2!L96YG=&@H<U]V
M87(I#0H@(" @<U]V87(@/2!S7W9A<ELQ+BYF+3%=("8@<U]V87);9BLQ+BYL
M70T*(" @('-?9&%T82 ]('-?9&%T85LQ+BYF+3%=("8@<U]D871A6V8K,2XN
M;%T-"B @("!S7W9A<E]S=')U8W0@/2!S7W9A<E]S=')U8W1;,2XN9BTQ72 F
M#0IP=71S*#$L('9A;'5E7V]F*")C870N<V5X(BDI('!U=',H,2P@>S$P+" Q
M,3 I#0H_('9A;'5E7V]F*")D;V<N8FER=&AY96%R(BD-"G!U=',H,2P@=F%L
M=65?;V8H(F1O9RYS97@B*2D@<'5T<R@Q+"![,3 L(#$P?2D-"@T*/R!V86QU
/95]O9B@B8V%T(BD-"@T*
`
end