The Infamous (or Famous) MUMPS Comma

318 views
Skip to first unread message

Chris

unread,
Nov 30, 2009, 8:53:17 PM11/30/09
to Hardhats
After rummaging through some wonderful patient registration routines
it came to my attention...

MUMPS supports a short-circuit "and" operator... the infamous comma. I
could not find any documentation on the use of comma on Mumps by
Example, GT.M Programmer's Guide, and InterSystems Online
Documentation.

Is my find correct? Are there any other gotchas that aren't documented
with M?

Given:
^CHRISU=123

For example...

Scenario 1 - The second sub expression is NOT evaluated because the
first sub expression is false.
CACHE>I 0,$P(^CHRISU(1),"^",1)
CACHE>

Scenario 2 - The second sub expression IS evaluated because the first
sub expression is true. We know this because we intentionally caused
^CHRISU(1) to fail.
CACHE>I 1,$P(^CHRISU(1),"^",1)
I 1,$P(^CHRISU(1),"^",1)
^
<UNDEFINED> ^CHRISU(1)
CACHE>

Expected use of the & operator.
CACHE>I 0&$P(^CHRISU(1),"^",1)
I 0&$P(^CHRISU(1),"^",1)
^
<UNDEFINED> ^CHRISU(1)

Sam Habiel

unread,
Nov 30, 2009, 9:07:37 PM11/30/09
to hard...@googlegroups.com
Chris, the comma is not really a "short circuit". Section 8.1 of the M
95 standard says the following:

For all commands allowing multiple arguments, the form
commandword arg1,arg2,... argn

is equivalent in execution to
commandword arg1 commandword arg2 ... commandword argn

For the if command, it does act as a short-circuit, except it's not
really a true one.

I A,B,C is the same as I A I B I C

Sam
> --
> http://groups.google.com/group/Hardhats
> To unsubscribe, send email to Hardhats-u...@googlegroups.com

I, Valdes

unread,
Nov 30, 2009, 10:00:55 PM11/30/09
to Hardhats
I thought he said Coma :-) -- IV

On Nov 30, 8:07 pm, Sam Habiel <sam.hab...@gmail.com> wrote:
> Chris, the comma is not really a "short circuit". Section 8.1 of the M
> 95 standard says the following:
>
> For all commands allowing multiple arguments, the form
>  commandword arg1,arg2,... argn
>
> is equivalent in execution to
>  commandword arg1 commandword arg2 ... commandword argn
>
> For the if command, it does act as a short-circuit, except it's not
> really a true one.
>
> I A,B,C is the same as I A I B I C
>
> Sam
>

Frederick D. S. Marshall

unread,
Nov 30, 2009, 10:18:27 PM11/30/09
to hard...@googlegroups.com
Dear Chris,

Sam is quite right. The comma is not an operator. It is just a
delimiter, a separator between multiple arguments.

One consequence is that in MUMPS it's easier to create a short circuit
for your Ands (using multiple IF arguments) than it is to create a short
circuit for your Ors (which requires a $SELECT function, or requires
inverting your test to express it as negated Ands, or requires other
more complex tricks with block structure and IFs and QUITs).

If MUMPS really, deliberately, had built-in short-circuiting, it would
be designed analogously for both the Ands and the Ors. Because MUMPS
does have these fairly simple indirect ways to create the effect of
short-circuiting, we were never motivated to explicitly add short
circuiting operators to the language.

Yours truly,
Rick

Chris

unread,
Dec 1, 2009, 2:05:20 AM12/1/09
to Hardhats
Wonderful explanations and clarifications. Thanks all!

Follow up question... Where may I read the M 95 standard? I Googled a
bit and well... my kungfu is not returning dividends.

Thanks again!
Chris

On Nov 30, 5:18 pm, "Frederick D. S. Marshall"

K.S. Bhaskar

unread,
Dec 1, 2009, 7:31:55 AM12/1/09
to hard...@googlegroups.com
For the record, GT.M has always (well, at least as long as I have been
associated with it) short circuited the evaluation of logical expressions.

Regards
-- Bhaskar

GT.M - Rock solid. Lightning fast. Secure. No compromises.
_____________

The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.
_____________

Sam Habiel

unread,
Dec 1, 2009, 11:48:09 PM12/1/09
to hard...@googlegroups.com
I have the standard, but it says the following on the second page:

"No part of this publication may be reproduced in any form, in an electronic retrieval system or otherwise, without the prior written permission of the publisher."

The publisher is the "M Technology Association". It looks like they are dead (in the US at least; I found a UK link; probably unaffiliated).

Is there a better proof that Mumps is dead than the fact that in this day and age we can't find the Mumps standard online? I just googled "C# ECMA Standard", for comparison, and got the standard in the first link. Dead is, alas, a figure of speech. Many EMR vendors use Mumps as the language of their implementation.

My copy is from the Vista Expertise Network. Send an email to Rick and he may be able to get you a copy.

Sam

I, Valdes

unread,
Dec 2, 2009, 1:24:15 AM12/2/09
to Hardhats
My wife does that too. -- IV

K.S. Bhaskar

unread,
Dec 2, 2009, 7:46:25 AM12/2/09
to hard...@googlegroups.com

GT.M - Rock solid. Lightning fast. Secure. No compromises.


On 12/01/2009 02:05 AM, Chris wrote:
> Wonderful explanations and clarifications. Thanks all!
>
> Follow up question... Where may I read the M 95 standard? I Googled a
> bit and well... my kungfu is not returning dividends.

An electronic copy of ISO/IEC standard 11756:1999 (the ANSI standard is
dead, the ISO standard remains) can be purchased from ISO
(http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=29268).
It's not cheap.

Ed de Moel has an online annotated standard at
http://71.174.62.16/Demo/AnnoStd

For all practical purposes, with only two MUMPS implementations in
existence that matter, the standard is less important than the actual
behavior of the implementations.

Regards
-- Bhaskar

Nancy Anthracite

unread,
Dec 2, 2009, 7:58:48 AM12/2/09
to hard...@googlegroups.com
She is just thinking out of the box, a valuable skill. ;-)
--
Nancy Anthracite

Mike Ginsburg

unread,
Dec 2, 2009, 9:20:27 AM12/2/09
to hard...@googlegroups.com
Speaking of old MUMPS stuff... Does anyone have a copy of the MUMPS
Development Committee bylaws?

Thanks,
Mike

Frederick D. S. Marshall

unread,
Dec 2, 2009, 2:11:19 PM12/2/09
to hard...@googlegroups.com
Dear Mike, Sam, and others,

The Network has permission from the MDC chair to bring the MUMPS
standard back into print. I recently finished resetting the whole thing,
top to bottom, and have only the index left to do. When that's finished
(which I hope to do over Christmas break) we'll publish it again so it's
widely available. We should have the first copies available at the VISTA
Community Meeting in Tempe, where we'll be doing a session on the future
of MUMPS, so if you're interested you should come.

We do have all of the MDC bylaws and so on of course, which we've used
to create bylaws and working documents for a new MUMPS Standards
Organization that will pick up where the MDC left off. The MSO will
begin by running the MUMPS validation suite against all extant version
of MUMPS to create an authoritative report on how much of the 1995
standard each one complies with. That document will be used to help us
decide the right strategy for the next MUMPS standard.

We already know the next MUMPS standard will be a conservative change
from the current one, since we need a simple project to exercise the new
MSO and work out the bugs. We're currently planning to raise all the
portability limits and accept all of the MDC type A extensions that are
bug fixes. Beyond that it'll be up to the MSO team and the MUMPS
community to decide what limited changes are included in the next
standard. I'm hoping to launch the MSO at the Tempe meeting, but I can't
yet confirm whether we'll be quite ready then. I'll keep the hardhats
list posted as the launch develops.

Yours truly,
Rick

Mike Ginsburg

unread,
Dec 2, 2009, 2:19:23 PM12/2/09
to hard...@googlegroups.com
Rick,

That's good to know.

However, my interest in the bylaws is to see if they could be a template for
a VistA Development Committee. If you could share a copy of the bylaws, I
would appreciate it.
Reply all
Reply to author
Forward
0 new messages