1. RE: shared memory

Hi Kat,

Just on your coding style (and since you pet Eu enhancement is goto!),
wouldn't the following be more readable and "possibly" better 
structureed?  (ie. without goto)

 if platform() = linux then 
   include file1.something 
   -- do other things

 elsif platform() = windoze then
    include file2LFN.e 
   --set it up

 elsif platform() = dos then
    include file3.umm 
   -- do whatever
 end if


I'm not stirring the pot!!! Just wondering why you use goto when a 
what I think is a better method doesn't use goto.

Regards,

Ray Smith
http://rays-web.com


Kat wrote:

> if ( platform() = linux ) then 
>   include file1.something 
>   -- do other things
>   goto eoconditionalincludes
> end if
> 
> if ( platform() = windoze ) then 
>    include file2LFN.e 
>   --set it up
>   goto eoconditionalincludes
> end if
> 
> if ( platform() = dos ) then include file3.umm end if
> :eoconditionalincludes:

new topic     » topic index » view message » categorize

2. RE: shared memory

Ray Smith wrote:
> Hi Kat,
> 
> Just on your coding style (and since you pet Eu enhancement is goto!),
> wouldn't the following be more readable and "possibly" better 
> structureed?  (ie. without goto)

*snip*

i don't think you can include files inside anything. that's why we have 
dynincl.e

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

3. RE: shared memory

On 24 Jul 2002, at 23:08, Ray Smith wrote:

> 
> Hi Kat,
> 
> Just on your coding style (and since you pet Eu enhancement is goto!),
> wouldn't the following be more readable and "possibly" better 
> structureed?  (ie. without goto)
> 
>  if platform() = linux then 
>    include file1.something 
>    -- do other things
> 
>  elsif platform() = windoze then
>     include file2LFN.e 
>    --set it up
> 
>  elsif platform() = dos then
>     include file3.umm 
>    -- do whatever
>  end if

And what if each elsif block had 100 lines of code, and you had to manually 
indent or otherwise tag each block, just so you could FIND the blocks? Elsif 
is converted to jmp commands in the machine code, which is a goto.

Kat

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

4. RE: shared memory

On 25 Jul 2002, at 13:05, sephiroth _ wrote:

> 
> 
> Ray Smith wrote:
> > Hi Kat,
> > 
> > Just on your coding style (and since you pet Eu enhancement is goto!),
> > wouldn't the following be more readable and "possibly" better 
> > structureed?  (ie. without goto)
> 
> *snip*
> 
> i don't think you can include files inside anything. that's why we have 
> dynincl.e

That is why i was suggesting to Rob that we have dynamic includes inside 
code.

Kat

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

5. RE: shared memory

Hi Kat,

Time to disagree with you.

after elsif's simply place a func() or proc()
code will be neat AND all you need to check
are the proc()s or funcs().

And for you, Ray, sorry, but includes have to
be outside the if.. elsif....end if construct.
No worry about large files though, because
EU2.3 only actually selects used routines
from libs.

EUHS ;) antoine

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

6. RE: shared memory

Either way, if Kat is against long elsif statements, it can be structured as

procedure proc_a()
   --stuff
end procedure

procedure proc_b()
   --stuff
end procedure

procedure proc_c()
   --stuff
end procedure

if (a) then
   proc_a()
elsif (b)
   proc_b()
else
   proc_c()
end if

:P

The only time I ever missed goto statements was when I first switched from 
basic to euphoria.... and that was only becuase I didn't know there was such 
thing as an elsif statement.
=====================================================
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__| Mr Trick

>From: sephiroth _ <euman2376 at yahoo.com>
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: RE: shared memory
>Date: Thu, 25 Jul 2002 13:05:21 +0000
>
>
>Ray Smith wrote:
> > Hi Kat,
> >
> > Just on your coding style (and since you pet Eu enhancement is goto!),
> > wouldn't the following be more readable and "possibly" better
> > structureed?  (ie. without goto)
>
>*snip*
>
>i don't think you can include files inside anything. that's why we have
>dynincl.e
>
>
>
>

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

7. RE: shared memory

On 26 Jul 2002, at 12:02, mistertrik at hotmail.com wrote:

> 
> Either way, if Kat is against long elsif statements, it can be structured as
> 
> procedure proc_a()
>    --stuff
> end procedure
> 
> procedure proc_b()
>    --stuff
> end procedure
> 
> procedure proc_c()
>    --stuff
> end procedure
> 
> if (a) then
>    proc_a()
> elsif (b)
>    proc_b()
> else
>    proc_c()
> end if
> 
> :P
> 
> The only time I ever missed goto statements was when I first switched from
> basic
> to euphoria.... and that was only becuase I didn't know there was such thing
> as
> an elsif statement.

I knew about elsif before i found Eu. I have 240 elsif, and 30 local vars, i
don't
want to make the vars global so those extra procedures can get to them. In 
addition,, rather than testing thru a huge stack of elsif, it's faster to know 
where in the program all the targets are, and goto the contents of the var, like
this:

-- var can be 001 to 620
procedure numeric(integer var)
goto var
:001: 
-- process 
goto end
:001:
-- process
goto end
.....
:620:
-- process

:end:
end procedure -- numeric

Kat

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

8. RE: shared memory

Ok, each to their own. I've never had problem with large elsif statements as 
long as they're indented correctly, and EE does that automagically for me, 
as well as putting the 'end if' in.

If I write set of elsif clauses with especially large contents, or it seems 
that the elsif statements may be confusing, I'll either put a double indent 
on anything inside, so it's easier to see, or put a comment label at the top 
of each branch, so I see it when scrolling past.
=====================================================
Besides, goto is evil :P (j/k)
.______<-------------------\__
/ _____<--------------------__|===
||_    <-------------------/
\__| Mr Trick



>From: Kat <gertie at PELL.NET>
>Reply-To: EUforum at topica.com
>To: EUforum <EUforum at topica.com>
>Subject: RE: shared memory
>Date: Thu, 25 Jul 2002 21:42:13 -0500
>
>
>On 26 Jul 2002, at 12:02, mistertrik at hotmail.com wrote:
>
> >
> > Either way, if Kat is against long elsif statements, it can be 
>structured as
> >
> > procedure proc_a()
> >    --stuff
> > end procedure
> >
> > procedure proc_b()
> >    --stuff
> > end procedure
> >
> > procedure proc_c()
> >    --stuff
> > end procedure
> >
> > if (a) then
> >    proc_a()
> > elsif (b)
> >    proc_b()
> > else
> >    proc_c()
> > end if
> >
> > :P
> >
> > The only time I ever missed goto statements was when I first switched 
>from basic
> > to euphoria.... and that was only becuase I didn't know there was such 
>thing as
> > an elsif statement.
>
>I knew about elsif before i found Eu. I have 240 elsif, and 30 local vars, 
>i don't
>want to make the vars global so those extra procedures can get to them. In
>addition,, rather than testing thru a huge stack of elsif, it's faster to 
>know
>where in the program all the targets are, and goto the contents of the var, 
>like
>this:
>
>-- var can be 001 to 620
>procedure numeric(integer var)
>goto var
>:001:
>-- process
>goto end
>:001:
>-- process
>goto end
>.....
>:620:
>-- process
>
>:end:
>end procedure -- numeric
>
>Kat
>
>
>
>

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

9. RE: shared memory

-------Phoenix-Boundary-07081998-

Hi Kat, you wrote on 7/24/02 4:34:04 AM:

>
>Has anyone looked at the shared memory on the recent contribs page (by 
>Jason and Mario), with a mind to make it platform independant (like by 
>using 
>platform())=3F Umm, errr, when it gets put on the page, later today,, ok=3F
>
>Rob and Karl, this is another good example of a reason to use includes in 
>code, to reduce sizes:
>
>if ( platform() =3D linux ) then 
>  include file1.something 
>  -- do other things
>  goto eoconditionalincludes
>end if
>
>if ( platform() =3D windoze ) then 
>   include file2LFN.e 
>  --set it up
>  goto eoconditionalincludes
>end if
>
>if ( platform() =3D dos ) then include file3.umm end if
>:eoconditionalincludes:
>

Have you noticed that Bliss (soon to be renamed Bach)
supports the use of variables in include names=3F

   sequence syscode =3D "Unknown platform"

   if platform() =3D linux then
      syscode =3D "linuxfiles.e"
   else if platform() =3D dos then
      syscode =3D "dos_files.e" 
   end if

   include (syscode)


Karl Bochert



-------Phoenix-Boundary-07081998---

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

Search



Quick Links

User menu

Not signed in.

Misc Menu