It is currently Tue Oct 23, 2018 9:17 am


All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Various Interpretations of String Values
PostPosted: Tue Nov 23, 2010 9:56 am 
User avatar

Joined: Wed Nov 17, 2010 4:02 pm
Posts: 68
Location: Houston TX
Real Name: David Whitten
Began Programming in MUMPS: 06 Jan 1982
One of the Standard MUMPS features that is not well understood by some new programmers is based on the fact that MUMPS has a single data type of "strings of characters" but has multiple interpretations of those characters when they are used in various ways by the language.
In contrast to other programming languages, the value stored in a variable in MUMPS is always the same characters, but the way it is written or used in program code is subject to the interpretation needed by a particular function or operator.

To take a string of characters and generate the various interpretations depends on using the string either with a unary operator (called in the MUMPS Standard a "unaryop") or as part of a syntactic form of a function.

The syntax for a unary operator consists of a punctuation character followed by an expression.
There are three unaryop's in MUMPS. These are the apostrophe, the plus sign, and the hyphen.

The syntactic form of an intrinsic function includes one of these words "expr" or or "glvn" or "intexpr" or "fncodexpr" or "numexpr" or "namevalue" or "tvexpr" or "stackcodexpr" or "textarg".

The syntactic form of an extrinsic function consists of an "actual" which is either "expr" or an "actualname".

There are a few other syntactic forms used for MDC standard functions, but not in the 1995 Standard.

This topic is intended to discuss the various interpretations, what they mean, and how they affect programmers, with special emphasis on things a new MUMPS programmer won't likely know.


Top
Offline Profile  
 
 Post subject: Re: Various Interpretations of String Values
PostPosted: Thu Jan 27, 2011 8:50 am 
User avatar

Joined: Wed Nov 17, 2010 4:02 pm
Posts: 68
Location: Houston TX
Real Name: David Whitten
Began Programming in MUMPS: 06 Jan 1982
I was thinking about the various interpretations of string values and thought I'd present a simple quiz:

1. What is the truth value of "FALSE" ?
2. What is the numeric value of "11+22" ?
3. What is the string value of "5*6" ?
4. What is the truth value of 15/20 ?
5. What is the numeric value of "TRUE" ?
6. How many fractional digits does "3Sombreros" have ?
7. If something has a value of "$49.99" what numeric value would it have ?
8. What about the numeric value of "01,234,567.89" ?

More Later.


Top
Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net