1. Issue of the week

Can Euphoria help the whole Y2K thingy? Are languages like COBOL and
FORTRAN our only hope? What'll happen to the earth when the clock strikes
12 midnight on 1/1/00? I found something scary in Euphoria. The first
argument date() returns is the year..........In double digits. So 1998
now reads 98 to Euphoria, and 2000 later will read 00 to Euphoria.

new topic     » topic index » view message » categorize

2. Re: Issue of the week

On Mon, 28 Sep 1998 13:04:52 -0400 Matt Z Nunyabidness
<matt1421 at JUNO.COM> writes:
>Can Euphoria help the whole Y2K thingy? Are languages like COBOL and
>FORTRAN our only hope? What'll happen to the earth when the clock
>strikes 12 midnight on 1/1/00? I found something scary in Euphoria.
>The first argument date() returns is the year..........In double
>digits. So 1998 now reads 98 to Euphoria, and 2000 later will read 00
>to Euphoria.

Uhh... It returns the number of years since 1900. Year 2000 will return
100.

I think that it SHOULD return the number of years since and including
year 1, but it's a bit too late to change that . . . Programs wouldn't be
backwards compatible.

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

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

3. Re: Issue of the week

> So 1998 now reads 98 to Euphoria, and 2000 later will read 00 to Euphoria.

no, it will read 100 (current_year - 1900)

I would also like to request, Matt, that you save up all your comments and
release them in digest form no more than once a day.  For me, with
unlimited web access, it's only an annoyance, but for some the concern is
monetary.  It's just common curtesy.  TIA(thanks in advance)

                isaac

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

4. Re: Issue of the week

Nothing will happen. It's going to happen in 2034.

- Nate

----------
> From: Matt Z Nunyabidness <matt1421 at JUNO.COM>
> To: EUPHORIA at LISTSERV.MUOHIO.EDU
> Subject: Issue of the week
> Date: September 28, 1998 1:04 PM
>
> Can Euphoria help the whole Y2K thingy? Are languages like COBOL and
> FORTRAN our only hope? What'll happen to the earth when the clock strikes
> 12 midnight on 1/1/00? I found something scary in Euphoria. The first
> argument date() returns is the year..........In double digits. So 1998
> now reads 98 to Euphoria, and 2000 later will read 00 to Euphoria.

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

5. Re: Issue of the week

Matt, Nate & co,

You are a bunch of incorrigible idiots. How many times do you have to
be told it cost some people real money to download your one line
garbage, long signatures and endless quotes? Stop it!

If you have an uncontrollable urge to communicate with each in this
manner, do it in private, do not pollute the list. jiri

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

6. Re: Issue of the week

On Mon, 28 Sep 1998 13:04:52 -0400, Matt Z Nunyabidness <matt1421 at JUNO.COM>
wrote:

>Can Euphoria help the whole Y2K thingy? Are languages like COBOL and
>FORTRAN our only hope? What'll happen to the earth when the clock strikes
>12 midnight on 1/1/00? I found something scary in Euphoria. The first
>argument date() returns is the year..........In double digits. So 1998
>now reads 98 to Euphoria, and 2000 later will read 00 to Euphoria.

1. COBOL is part of the problem, not the solution.
   Anyone who has programmed for more than a week
   knows that.
2. Test your assumptions before you post. It's easy
   to find out that Euphoria returns the correct
   date.
3. Don't post misinformation to multiple news groups -
   you are hurting RDS's sales.

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

7. Re: Issue of the week

Actually Euphoria's date() function returns a century preceded by a 1 (such
as 101 for 2001), much like the convention used on IBM AS/400 midrange
computers. This means you can safely perform operations like subtractions on
dates in two different centuries and not worry about any negative years
being returned.

-----Original Message-----
From: Matt Z Nunyabidness <matt1421 at JUNO.COM>
To: EUPHORIA at cwisserver1.mcs.muohio.edu
<EUPHORIA at cwisserver1.mcs.muohio.edu>
Date: Monday, September 28, 1998 1:05 PM
Subject: Issue of the week


>Can Euphoria help the whole Y2K thingy? Are languages like COBOL and
>FORTRAN our only hope? What'll happen to the earth when the clock strikes
>12 midnight on 1/1/00? I found something scary in Euphoria. The first
>argument date() returns is the year..........In double digits. So 1998
>now reads 98 to Euphoria, and 2000 later will read 00 to Euphoria.
>

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

8. Re: Issue of the week

>>Uhh... It returns the number of years since 1900. Year 2000 will return
>100.
>
>I think that it SHOULD return the number of years since and including
>year 1, but it's a bit too late to change that . . . Programs wouldn't be
>backwards compatible.

Since when cant Euphoria handle negative integers ?
However, the most common used scope for years is from 1900 - 2150 (total of
250)
The value ex.exe gives you fits in a bit, for the next so-many years.
It you want a bigger scope, just write out more bytes.
But for now, the smallest scope is used.
By the time we reach > 2150, we needed to worry about diskspace as much as
now, and can easily use 2 or more bytes. Without breaking any existing code.

Euphoria is once again.. TESDEN.
(Too Elegant Some Dont Even Notice)

Ralf

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

9. Re: Issue of the week

I wrote:
>>I think that it SHOULD return the number of years since and including
>>year 1, but it's a bit too late to change that . . . Programs
>>wouldn't be backwards compatible.

Ralf replied:
>Since when cant Euphoria handle negative integers ?
>However, the most common used scope for years is from 1900 - 2150
>(total of 250) The value ex.exe gives you fits in a bit, for the next
>so-many years. It you want a bigger scope, just write out more bytes.
>But for now, the smallest scope is used.
>By the time we reach > 2150, we needed to worry about diskspace as
>much as now, and can easily use 2 or more bytes. Without breaking any
>existing code.

Well, let me clarify on this:

Let's say you write a program, using two digit numbers (because you
didn't read the REFMAN.DOC close enough). Then, in the year 2000, when
your program is used, the dates suddenly become 100. Of course, the
author could easily fix that by adding 100.

But if Euphoria used the full year, it would always use 4 digit years.
The way it is now, the programmer has to always add 1900 when he/she
displays the date for the program to be Y2K compliant. (Otherwise, it's
suddenly 100, and maybe he only had room for 2 digits in the program, so
now it's all unaligned because it's using 3 spaces now.)

Also, think about this: Once the year 2000 comes around, any program
written will either have to subtract 100 (To use 2 digit years (00, 01,
etc. But then it wouldn't be Y3K compliant... ;) ) or add 1900 for 4
digit years.

Now, wouldn't it be nicer if Euphoria always returned 4 digits? It
wouldn't use up any more memory (an integer uses the same amount of
space, be it 2 digits or 4), and the programmer wouldn't have to always
add 1900 to the dates. (If displaying, of course, if using calculations,
everything would seem normal.) But, Euphoria doesn't, and can't, because
it's too late. Otherwise, programs that are Y2K compliant (add 1900) will
suddenly show year 3900 in the year 2000.

Sorry about the long message. What can I say, I'm a programmer, and I try
to think out every possible bug in my message (even though some get
through ;) (It's either too simple (last message) or too in-depth, (this
one) your choice. :)


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

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

10. Re: Issue of the week

>Since when cant Euphoria handle negative integers ?
Since the REFMAN.DOC file that came with Euphoria 1.4a says it can
___________________________
When it comes to programming languages, Euphoria is a cut above -
matt1278 at juno.com and matt1421 at juno.com(and soon to be
irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer
Web users: <A HREF=mailto:"matt1421 at juno.com">matt1421 at juno.com</A> or <A

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

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

11. Re: Issue of the week

Why not just re-program the date() function for your own personal use?

It's a builtin, so a global ought to fix it...

function old_date()
    return date()
end function

--without warning -- These need uncommenting if you're not planning to
                  -- bind the program
global function date()
    sequence D
    D = old_date()
    D[D_YEAR] = D[D_YEAR] + 1900 -- You get the picture even if this is
    return D                     -- wrong :)
end function
--with warning

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

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

12. Re: Issue of the week

Carl R. White wrote:
> function old_date()
>     return date()
> end function
>
> without warning
> global function date()
>     sequence D
>     D = old_date()
>     D[D_YEAR] = D[D_YEAR] + 1900
>     return D
> end function
i'm not sure i understand this... or, at the very least,
i wasn't aware that builtin functions could be overloaded...

the only way i can think of to attempt to determine if
i understand this, and it's mechanism, it to throw
an example back, to see if i can apply what i have learned
(or thought i learned) to a problem of practical nature.

a while back, i observed that X*X worked (oftenly)
much faster than power(x,2).
so:
function oldpower(object x, object y)
  return power(x,y)
end function

without warning
function power(object x, object y)
   if int(y) then
        --fast squares
        if y=2 then return x*x   end if
        --fast cubes
        if y=3 then return x*x*x end if
   end if
   return oldpower(x,y)
end function
with warning

now if the above is correct, at least i understand
the implementation of this concept...although,
i'm not so sure i understand the mechanism of
how it works...

('tis one of the reasons i am not partial to C,
 overloading gives me headaches...
   "but! but! but!, that '*' doesn't _really_ mean
    multiplication!")

--Hawke'

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

13. Re: Issue of the week

On Wed, 30 Sep 1998, Hawke wrote:

[Snip my code. My messages are becoming too long these days. Sorry folks.]

> i'm not sure i understand this... or, at the very least,
> i wasn't aware that builtin functions could be overloaded...
>
> the only way i can think of to attempt to determine if
> i understand this, and it's mechanism, it to throw
> an example back, to see if i can apply what i have learned
> (or thought i learned) to a problem of practical nature.
>
> a while back, i observed that X*X worked (oftenly)
> much faster than power(x,2).
> so:
> function oldpower(object x, object y)
>   return power(x,y)
> end function
>
> without warning
> function power(object x, object y)
>    if int(y) then
>         --fast squares
>         if y=2 then return x*x   end if
>         --fast cubes
>         if y=3 then return x*x*x end if
>    end if
>    return oldpower(x,y)
> end function
> with warning

This method *isn't* overloading as such. Not like in C or Ada anyway.
It's redefinition. In other languages, it'd be interpreted (or compiled :)
as mutual recursion, which Euphoria doesn't handle this way.

>  ...overloading gives me headaches...
>    "but! but! but!, that '*' doesn't _really_ mean
>     multiplication!")

I like overloading. I think it's useful, but yes, it *is* possible to
misuse it. Take the following Ada Code:

type Dodgy is new Integer;
-- Have to define a new type 'cause Int*Int->Int is already defined!

function "*"(Left: Integer; Right: Integer) return Dodgy is
begin
    return Dodgy(Left + Right); -- *Plus*?! Oh dear...

    -- read Dodgy() as "make_into_type_Dodgy" rather than
    -- "is_of_type_Dodgy". Ada =/= Euphoria remember!

end Dodgy;

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

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

14. Re: Issue of the week

wow. this thread has been going on, um, 2 or 3 days.
___________________________
When it comes to programming languages, Euphoria is a cut above -
matt1278 at juno.com and matt1421 at juno.com(and soon to be
irisnmatt at prodigy.net. Then again, maybe not) Euphoria programmer
Web users: <A HREF=mailto:"matt1421 at juno.com">matt1421 at juno.com</A> or <A

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

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

15. Re: Issue of the week

Carl R. White wrote:
>This method *isn't* overloading as such.
>Not like in C or Ada anyway.
>It's redefinition. In other languages, it'd
>be interpreted as mutual recursion, which
>Euphoria doesn't handle this way.
hrmmmm.... *ponder*.... ah, ya!, but no... ummm...
*you hear miscellaneous brain fart sounds*
wait, but yeah, hrmmm... ah!, yes, but... wait,no...
*thmoke, thmoke! i thmell thmoke!*
ummm... *think*....  hrmmmmmm....
okay... can we get a definition of mutual recursion
as defined by 1>everyone else & 2>EU ???
that might help me 'get' this...

>>  ...overloading gives me headaches...
>I like overloading.
>Take the following Ada Code:
>  type Dodgy is new Integer;
>  function "*"(Left: Integer; Right: Integer) return Dodgy is
>  begin
>     return Dodgy(Left + Right); -- *Plus*?! Oh dear...
>  end Dodgy;
i reiterate :)
overloading gives me headaches, *especially* when i see
s*it like presented above... redefining '*' as PLUS?
you are simply... evil!... dare i say downright _mean_???
;>

--Hawke'

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

16. Re: Issue of the week

On Thu, 1 Oct 1998, Hawke wrote:

Hawke, it seems you snipped/missed the bit where I was arguing that
overloading can be a bad idea... Sorry if my post confused :-S

And, with the Ada code I was overloading, not redefining. One is not the
other. Gotta be careful with these things... :)

On the other hand the smiley at the bottom could just mean you're
"'avin a larf", I bit, and you're now reeling me in :)

> >Take the following Ada Code:
> >  type Dodgy is new Integer;
> >  function "*"(Left: Integer; Right: Integer) return Dodgy is
> >  begin
> >     return Dodgy(Left + Right); -- *Plus*?! Oh dear...
> >  end Dodgy;
> i reiterate :)
> overloading gives me headaches, *especially* when i see
> s*it like presented above... redefining '*' as PLUS?
> you are simply... evil!... dare i say downright _mean_???
> ;>

Happy coding,
Carl

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

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

17. Re: Issue of the week

Carl R. White wrote:
>Hawke, it seems you snipped/missed the bit where I
>was arguing that overloading can be a bad idea...
no.... i did understand that part... twas 'bout the only
part... heh.

>And, with the Ada code I was overloading, not redefining.
>One is not the other. Gotta be careful with these things... :)

_sigh_... still not sure i get that part tho...

i've managed to catch that overloading refers to operators
while redefining refers to functions... right?

the examples with date and power, being redefining, i can
see the benefits and uses.

the overloading... different story...
one word: WHY?
why on this green planet would you wanna overload?

the only example i can think of, where overloading might
be actually good (as opposed to C/C++ with it's utterly
stupid (imo) overloading, that isn't really needed anyway)
is perhaps an operator like AND.  we could overload it
to perform shortcircuit AND'ing.  this i could visualize.


>> you are simply... evil!... dare i say downright _mean_???
>> ;>
>On the other hand the smiley at the bottom could just mean you're
>"'avin a larf", I bit, and you're now reeling me in :)
the simley only referred to the line above where i'm callin'
ya a big meanie! ;)

the part above that where i referred to overloading giving
me a headache as you "overloaded" the '*' to mean PLUS
was darned near serious...

mebbe it's just me, but try as i might, i cannot come up
with code that obfuscated.  my teachers used 20lb sledge's
to bash my brains with the 'code clearly' concept.
i still have nightmares =->

--Hawke' (still a wee puzzled and con-fus-elled)

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

18. Re: Issue of the week

Maybe we ought to rename this thread "The Cyrek and Hawke Show"
or something :)

On Fri, 2 Oct 1998, Hawke wrote:

> the part above that where i referred to overloading giving
> me a headache as you "overloaded" the '*' to mean PLUS
> was darned near serious...

I was demonstrating what *could* be done. Not "*should* be" :)

> mebbe it's just me, but try as i might, i cannot come up
> with code that obfuscated.  my teachers used 20lb sledge's
> to bash my brains with the 'code clearly' concept.
> i still have nightmares =->

It's dictionary (on the fly) definitions time:

1) Overloading: To have more than one function/procedure with the same
   name doing different things. If I had time, I'd patch one of the
   preprocessors to do it in Euphoria.

   You (and the compiler/interpreter) can tell them apart by what
   parameters they accept...

   e.g. These are all completely different (despite having the same name):

       procedure cheese(integer a, integer b)
           -- Two parameters of type integer
       end procedure

       procedure cheese(integer a, atom b)
           -- Two parameters, first integer, second atom
       end procedure

       function cheese(integer a, atom b)
           -- Two parameters, first integer, second atom
           -- Just like above, but this is a *function*
           return power(b,b-a)
       end function

       procedure cheese(atom a, integer b)
           -- Two parameters, first atom, second integer
       end procedure

       procedure cheese(integer a, integer b, integer fish)
           -- Three parameters of type integer
       end procedure

2) Redefining: Completely re-writing the function/procedure, overriding
   the original. This is only really possible in Euphoria. Most other
   languages will complain (C will for instance) or attempt to Overload
   the function/procedure (Ada, C++, newer Pascals). I showed examples of
   this in earlier posts.

Any clearer, or should we move to one-on-one e-mail?
Carl

--
Carl R White
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
Url......: http://www.bigfoot.com/~cyrek/
"Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr." - B.Q.Vgesa

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

19. Re: Issue of the week

how long has this 'Issue of the week' thread been going on? This was only
meant to go on for a week.
_________________
When it comes to programming languages, Euphoria is a cut above
matt1278 at juno.com Euphoria programmer
Webbers: <A HREF="mailto:prezsoft at juno.com">prezsoft at juno.com</A>,
president of SoftCo. All virus proggers should die horrible deaths™

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
or call Juno at (800) 654-JUNO [654-5866]

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

20. Re: Issue of the week

Carl R. White wrote:
> Maybe we ought to rename this thread "The Cyrek and Hawke Show"
> or something :)
if noone else needed a refresher/coaching/instruction on
overloading or redefining, and noone found this to be
interesting or intriguing in any way, then oopsie! apologies
for wasting ever so crucial bandwidth.

> Any clearer, or should we move to one-on-one e-mail?
yeah, actually it is...
the more i tinker with euphoria, the more i see how
truly elegant this creation of rob's is.  killer handling
of recursion (how many languages do you know of that can
handle a stack limited by only available RAM/HD space???)
and now i'm introduced to this neat new toy.  i don't
know that i would have ever found myself needing this toy,
since i never really program in this fashion, and thusly
don't really _think_ in that fashion as i'm flowcharting.
now that i know this toy exists, i'm thinking of more and
more ways that it could have made certain coding chores...
practically trivial actually.

example: this new thread on value()... i can see overloading
and/or redefining as coming in real handy at this point.

function oldvalue(object x)
   --how does this work again???
   return value(x) --is that right?
end function

function value(object x)
   if    find('*',x) then --multiply
   elsif find('+',x) then --addition
   --blahblah, subtraction, division, power(^), etc
   else return oldvalue(x) --it's just a normal value() call
end function

would the above be right as a potential pseudocode prototype
of what [whoever] was asking for???

--Hawke'

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

21. Re: Issue of the week

> > Maybe we ought to rename this thread "The Cyrek and Hawke Show"
> > or something :)
> if noone else needed a refresher/coaching/instruction on
> overloading or redefining, and noone found this to be
> interesting or intriguing in any way, then oopsie! apologies
> for wasting ever so crucial bandwidth.

no, No, NO!  ;')  Remember, you have these people like me who really
enjoy reading these things and learn something.  I just don't have much
to add in here.  But PLEASE don't drop threads like this.  What seems
amazing to me is that I am learning, not just Euphoria coding, but about
programming in general.  Anyways, nothing else to say at the moment, so
keep up the good work.  ;')

\/\/ood/\/\age

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

22. Re: Issue of the week

> example: this new thread on value()... i can see overloading
> and/or redefining as coming in real handy at this point.

[Code snipped. Mostly reproduced below. See previous post for original]

> would the above be right as a potential pseudocode prototype
> of what [whoever] was asking for???

You've got the concept OK (It's a redefinition). Just a few small quirks:

1) The original subprogram (function/procedure, the one you're redefining
   anyway) must be a built-in or (IIRC) a global subprogram in an included
   library. There's no point in redefining something in the same program
   is there? :)

2) The redefined subprogram must be global (to counter the globality of
   the original)

3) Put it between a "without warning" and "with warning", unless or until
   you bind/shroud the code. (Binding/Shrouding automatically adds a
   "without warning" at the very top of the code, even before the includes
   you might have used.

Re-write time :)

function oldvalue(object x)
    return value(x)
end function

without warning
global function value(object x)
    -- Looking at it, I'm not sure this function would do what you want,
    -- (you'd need a loop or something) but it illustrates the point. :)
    if    find('*',x) then
        -- handle multiply
    elsif find('+',x) then
        -- handle addition
    elsif ... then
        -- subtraction, division, power(^), etc.
    else
        return oldvalue(x) --it's just a normal value() call
    end if -- Don't forget this ;)
end function
with warning

ICYWW[1], the oldvalue() is created to stop unwanted recursion.
If Euphoria couldn't recurse (/me sucks teeth and winces) we wouldn't need
to do this. Actually, if Euphoria couldn't recurse, I don't think I'd be
here. I'd be on a C/Ada mailing list somewhere :)

HTH anyway,
Carl

PS If you've got time, check out SANITY.EX somewhere under the
EUPHORIA/DEMO directory. It uses this technique to redefine abort()...

Footnote:
[1] "In Case You Were Wondering" ;)

--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
URL......: http://www.bigfoot.com/~cyrek/
Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa

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

Search



Quick Links

User menu

Not signed in.

Misc Menu