Re: suggestion

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

Irv wrote:
> Vikas B. Patel wrote:
> >
> > Hi,
> > C and C++ also have BLOCK COMMENTS!
> > it's kinda annoying to put '--' in front of every line!
> > Euphoria needs block comments (or am i wrong?)
> > Bye,
>
> So does Turbo Pascal, but it's just no big deal. Sometimes having block
> comments can cause problems; after you add  and delete a lot, you can
> accidently comment out some working code. I prefer the --'s

        If people want stuff like this in Euphoria, there is no need for RDS to
rewrite it. Cause the compiled EUphoria code that will be executed will
be the same. (Just like the suggestions about =+ and ++)
        You can for example write a preprocessor, a program that replaces your
new code, with the good euphoria code.
        Or you can wait for David Cuny to have a working version of the macro
language.
        Then you enter such stuff in a definition file like this:

        | ^1 ++ |
                >> ^1 = ^1 + 1

        | ^1 -- |
                >> ^1 = ^1 - 1

        | ^1 -= |
                >> ^1 = ^1 -

        BTW this language is still to be changed, real practical work has not
been done, just wait for him to finish this tool, that will makes us all
able to write a lot compact and cleaner code.

        No, here's a real suggestion... (RDS will need to totally rewrite their
code to this implend this one, so i guess they won't)

        This is based upon the ICON language...
        Every function can return two types of return-values:
                + FAILURE       (something like false)
                + NON-FAILURE   (Normal function respons)

        Now lets say, that in a function the word 'suspend' returns a value,
but if there are more values wanted the code will be executed from the
suspend. The keyword every, makes us always want to have every value.
        AN example:

        -- This function returns values from 1 to a*2, stepping 2.
        function upto2 ( integer a )
                for j = 1 to a do
                        suspend a*2
                end for
        end function

        -- This will print all the numbers..
        every print(1, upto2 ( 10 ) )

        -- ALso you can do this trick
        sequence text_sequence
        text_sequence = "I will count the spaces in this sentence"
        every find(' ' , text_sequence) puts(1,"Found another space!\n")

        -- We need this function too..
        function upto (integer a)
                for r = 1 to a do
                        suspend r
                end for
        end function

        -- We can also strip all the spaces..
        sequence new_text
        every (not find(' ', text_sequence)) new_text = append(new_text,
text_sequence[upto(length(text_sequence))])

--------------------------------------------------------------------------
        Kind a looks interesting doesn't it, very short compact code...
        Every more loops are avoided with these tricks.
        We all know that if we want to strip all spaces now, it takes up a lot
more code.
        I somebody wants to know more about, do a web-search on:

                ICON PROGRAMMING LANGUAGE

        ALthrough this is hard to implend, i do think you should consider this
Robert, it will make Euphoria even more powerfull and you don't need to
rewrite the stuff that executes the code, but only the compiler (to be
able to compile this kind of code), am i right ?
        Please give me your opinion...

Ralf NIeuwenhuijsen
nieuwen at xs4all.nl

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

Search



Quick Links

User menu

Not signed in.

Misc Menu