Menu

#40 Have min() and max() handle objs, strings and errors

open
nobody
5
2006-03-13
2006-03-13
Goblin
No

This patch makes min() and max() able to handle
objectnumbers, strings and errors above integers and
floats.

min(#0, #1) == #0
max(#0, #1) == #1

min("a", "b") == "a"
Note: this is based on lectical value (is that what
it's called in English?)

min(E_NONE, E_PROPNF) == E_NONE

Especially the use with objects points out to be very
usefull. A rewrite of $list_utils:sort using min()
saved a hell lot of ticks.

Credits for the string-part of this patch go to
Moonlit@PhantasyWorld

Discussion

  • Goblin

    Goblin - 2006-03-13

    Patch for numbers.c

     
  • Goblin

    Goblin - 2006-03-13

    Logged In: YES
    user_id=1436857

    You need to make a few adjustments to the MOO aswell, to
    maintain backwards compatibility with unpatched min() and max().
    Download file MOOcode_patch.txt

     
  • Goblin

    Goblin - 2006-03-13

    MOOcode-patch for backwards compatibility

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.