Re: Euphoria 2.5
- Posted by "Juergen Luethje" <j.lue at gmx.de> Jul 29, 2004
- 629 views
Hi Igor, you wrote: > Hi Juergen, > > [snipped old info] >> Igor Kachan wrote: >>>> From: Juergen Luethje >>>> Sent: 28 jul 2004 y. 23:39 >>>> Igor Kachan wrote: >>>>> CK Lester wrote: >>>> How should B_ and C_ be defined, and how >>>> should the appropriate value >>>> be assigned to B_ and C_? >>>> Will you define a separate type for each sequence? >>>> >>>> <snip> >>> >>> Yes, a separate type for each sequence. >>> >>> }}} <eucode> >>> integer B_ >>> type sequence_with_length_B() >>> ... >>> end type >>> >>> integer C_ >>> type sequence_with_length_C() >>> ... >>> end type >>> >>> integer D_ >>> type sequence_with_length_D() >>> ... >>> end type >>> </eucode> {{{ >> >> And what is the advantage compared >> to conventional Euphoria programming >> style, i.e. not using all those types, >> but using 'length(A_A)', >> 'length(A_B)' etc. directly? > > Really you have just 1 or 2 main sequences in your program. > For example, ed.ex editor. > So, you can enter these types and then > use A_ or B_ anywhere you want instead of, say, > length(First_Very_Long_But_Very_Clear_Name_of_Main_Sequence_1) > and > length(Second_Very_Long_But_Very_Clear_Name_of_Main_Sequence_2). Sorry, but this sounds somewhat theoretical to me. At least regarding to my personal coding style, this will be rather unlikely. If a sequence in my program is so important, that I feel necessary to give it a name such as 'First_Very_Long_But_Very_Clear_Name_of_Main_Sequence_1', then I probably will name the variable that holds its length 'Length_Of_First_Very_Long_But_Very_Clear_Name_of_Main_Sequence_1' rather than just 'A_'. Or, the other way round, if the variable 'A_' holds the length of the sequence, then the sequence itself will prbably have a name such as 'A' or 'sA'. Anyway, I think your trick can be useful when there are only a few sequences in the program, that often change their lengths, and the lenths are often needed by the program. So it's not necessary always to write A_ = length(First_Very_Long_But_Very_Clear_Name_of_Main_Sequence_1) But if there are say 20 sequences, I think adding 20 types would add considerable overhad to the program. > But you could not use $-feature in the same manner, > there is no the separate $-value at all. Yes, it will only work for subscripting and slicing, but for these purposes it will be more elegant than anything currently available in Eu 2.4, IMHO. Regards, Juergen