[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

# Re: Ideas about data types

- Date: Tue, 22 Jul 1997 14:41:17 EDT
- From:
- cc: moo-cows@the-b.org
- In-reply-to: Your message of "Tue, 22 Jul 1997 10:53:27 PDT." <199707221753.KAA15412@netcom5.netcom.com>

    A couple of points:

    Firstly, with regard to literals of new data types, I expect that the
    best way to implement this would be in the lexical analyzer.  It would
    be fairly simple to call a series of load-time registered functions at
    the end of the lexical analyzer.  The parser would then need to deal
    with a generic "literal data" token.  The goal would be to avoid
    recompilation of the lexical analyzer, and certainly to avoid
    re-lexing and re-yaccing, when adding new data types.

    Also, we may want to consider changing the way in which the server
    deals with "INT", "FLOAT", etc.  Currently, these are *variables*
    automatically created at the beginning of each stack frame.  I think
    that "plug-in" data types would be an excellent place to change this
    somewhat ugly behavior.

    On the issue of operators, I would point out that some MOO operators
    are already overloaded (i.e., perform multiple functions depending on
    the types of their arguments).  For instance, if '+' gets integers, it
    performs integer addition; with floats, it performs floating point
    addition; and with strings, it concatenates.  It would be fairly
    simple to allow new data types to register functions for the various
    operators.  This could be handled in the guts of run() in a manner
    transparent to the parser and to the lexical analyzer...

    --Nick

Follow-Ups:

- Re: Ideas about data types

- From: whitten@netcom.com (David Whitten)

References:

- Ideas about data types

- From: whitten@netcom.com (David Whitten)

- Prev by Subject: Ideas about data types
- Next by Subject: Re: Ideas about data types
- Prev by thread: Ideas about data types
- Next by thread: Re: Ideas about data types
- Index(es):
  - Subject
  - Thread

Home | Subject Index | Thread Index