It is currently Wed Oct 04, 2023 3:13 pm

All times are UTC - 8 hours [ DST ]

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Idea.1 - an approach for namespaces
PostPosted: Tue Nov 23, 2010 10:34 pm 
Site Admin

Joined: Mon Nov 01, 2010 1:31 pm
Posts: 10
Location: Las Cruces, NM 88012 USA
Real Name: LD "Gus" Landis
Began Programming in MUMPS: 15 Aug 1991
Presently the VISTA SAC (Standards And Conventions) describes the use of
VISTA Number and Name Spaces (VNNS). The conventions used are, IMO,
rather hard to deal with because the variable names become too hard to deal
with for typical namespaces (of 3 or 4 characters, short 1 or 2 character name
spaces are bad enough, but very difficult to obtain).

The following idea is one that would allow the source code to be preprocessed
into conventional MUMPS, where the tools (such as VPE, Eclipse, etc) would
deal with the substitution.

A downside, clearly, is that anyone looking at the resulting MUMPS code would
not get the benefit of the notational clarity of the original... BUT all of the coding
information for the "original" is preserved in the processed source... so "round
trip" (to and from) should be possible from either.

# $Id: Idea.1,v 20080220.1 2008/02/21 04:54:40 ldl Exp ldl $
# vforum:$Source: /home/vforum/RCS/Idea.1,v $

The localized namespace problem severely highlights the
failure of the current M[UMPS] Standard (and implementations)
to address access and control of the symbol table.

Current recommended VistA practice significantly impedes the
readability of the resulting code, by:
- do not allow for clear, nor safe names
- exchanging hard to keep straight symbol table problems with
unreadable code (twisty little variations of the endings of
variable names, running the significant risk of confusion)
- comments attempting to rectify the above are completely
inadequate and they tend to create a "second program" (a
program within a program) that needs to be maintained so
as to not mislead the reader.

An idea for namespaces without needing M[UMPS] extensions.

- Allows for "mangling" of the descriptions without having to
visually clutter the source code.

- Allows for "mangling" the desciptions without requiring VPE.

- Use a conventional dot notation to separate namespace from
namespace element to avoid confusion with pass by reference

- Tag externally visible labels with a leading '&' (similar
to existing M[UMPS] referencing of external library packages

- Labels lacking the "external" '&' tagging are private

- Label "mangling" provides strong visibility of externally
accessible tags, and automatically (lightly) hides local
private tags.

- Keep description in the routine following the reserved tag,
here using "NAMESPEC", but it could be any tag we decide on.

- Spec is accessible via $TEXT() for introspection and other
mechanisms we desire.

- Almost no thought has been put into where this can go, but
lots of ideas are rolling around, including the ability to
coordinate namespaces with "include" or other mechanisms.

The main idea is that VPE (or other process) is able to de-ugly
(or less ugly) the routine by annotating the code in a more
conventional namespace form, while not changing what the
resulting M[UMPS] code sees.

Items known to be missing (but seen as tractable):
- Namespace replacement within strings, if even needed

Sample Source code that VPE munges to/from routine source

VPE display of the routine
| 1 X.1 ;;VistA Header 1
| 2 ;;VistA Header 2
| 3 Q
| 4 &MAIN ; Main entry point
| 5 N X.SAM S X.SAM=""
| 6 F S X.SAM=$O(^GVN(X.SAM)) Q:X.SAM="" D
| 7 . D SUB(.X.SAM)
| 8 Q
| 9 ;
| 10 SUB(X.VAR) ; Private routine SUB
| 11 W X.VAR,Y.MAX,!

| Namespace Description
| --------- -----------------------------
| ZLDL Description of namespace ZLDL
| ZDLW Description of namespace ZDLW

| Namespace Variable Type Description
| ---------- ------------- ------ ----------------------------------
| ZLDL X.PETE String Description of PETE
| X.SAM String Description of SAM
| X.VAR String Description of VAR
| ZDLW Y.MAX Number Description of MAX

Routine source for the above
ZLDL1 ;;VistA Header 1
;;VistA Header 2
XSUB(ZLDLVAR) ; Private routine SUB
NAMESPEC ;; <XML 'various XML chatter'>
;; Description of namespace ZLDL
;; <VAR NAME="SAM" TYPE="String">Description of VAR</VAR>
;; <VAR NAME="PETE" TYPE="String">Description of PETE</VAR>
;; <VAR NAME="VAR" TYPE="String">Description of VAR</VAR>
;; Description of namespace ZDLW
;; <VAR NAME="MAX" TYPE="Number">Description of MAX</VAR>
$Log: Idea.1,v $
Revision 20080220.1 2008/02/21 04:54:40 ldl
Initial hack

Revision 20080220.1 2008/02/21 04:51:18 vforum
initial hack

End of $Id: Idea.1,v 20080220.1 2008/02/21 04:54:40 ldl Exp ldl $

3960 Schooner Loop 651-340-4007
Las Cruces, NM 88012-6067

Offline Profile  
 Post subject: Re: Idea.1 - an approach for namespaces
PostPosted: Tue Feb 15, 2011 6:44 pm 
Site Admin
User avatar

Joined: Mon Nov 01, 2010 1:58 pm
Posts: 205
Location: Seattle, Washington
Real Name: Frederick D. S. "Rick" Marshall
Began Programming in MUMPS: 15 Jun 1984
I have a different idea for making VISTA namespaces more manageable, but I can't describe it until after we get the next MUMPS standard released because it would be a shiny distraction.

Frederick D. S. "Rick" Marshall, VISTA Expertise Network, 819 North 49th Street, Suite 203, Seattle, Washington 98103, (206) 465-5765, rick dot marshall at vistaexpertise dot net
"The hidden harmony is best." - Heraclitus of Ephesus

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 2 guests

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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created