A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-August/016640.html below:

[Python-Dev] Parrot -- should life imitate satire?

[Python-Dev] Parrot -- should life imitate satire?Simon Cozens simon@netthink.co.uk
Thu, 2 Aug 2001 10:30:06 -0700
On Wed, Aug 01, 2001 at 12:42:42AM -0400, Tim Peters wrote:
> 		case BINARY_DIVIDE:

case? Wowsers. Hey, Ruby does that too. We use function pointers,
FWIW.

Oh, and here's our divide, for comparison:

PP(pp_divide)
{
    dSP; dATARGET; tryAMAGICbin(div,opASSIGN);
    {
      dPOPPOPnnrl;
      NV value;
      if (right == 0.0)
        DIE(aTHX_ "Illegal division by zero");
      value = left / right;
      PUSHn( value );
      RETURN;
    }
}

See, this is why we need a new interpreter. :)

In slightly more pseudo code:

PP(pp_divide)
{
    get_the_stack_pointer;
    find_somewhere_to_put_result;
    check_if_overloaded;
    {
      NV right = SvNV(POP);
      NV left  = SvNV(POP);
      NV value;
      if (right == 0.0)
        DIE(aTHX_ "Illegal division by zero");
      value = left / right;
      PUSHn( value );
      RETURN;
    }
}



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4