From MUMPS to MSH.Advantages of this language MUMPS audience known. I want to talk about the shortcomings.Standard language is good and bad at the same time. Good because ensures portability of programs. Bad because it does not allow the development of language. Since the last Standard MUMPS much time has passed. language has a lot of problems. It must be solved.I believe that there are two main problems. First is absence of objects in language. The second is weak event processing. The first problem implementors MUMPS sometimes trying, sometimes not trying to solve. Decision of CACHE I believe is unacceptable, because an objects contrasted with the data structure . With the decision of GTM I am not familiar.I want to suggest the ways to resolve these problems by using a new language MSH. Absence in the MUMPS variable declaration prevents inclusion objects in the language. Objects must be added to the MSH. Furthermore, I believe that a modern high level programming language must necessarily includes the developed event processing system. Of all the languages I know, only the assembler has the tools of event processing. Methodology of event processing is widely used in the programming practice both in a visual libraries (Delphi, GTK, and in others), and for constructing operating systems. Operating system at the libraries level, has different tools for processing events. Event processing in MUMPS extremely undeveloped and actually reduced to processing errors. Only ZTRAP command can create a custom event.

Let's try to add an objects to the language. Since there is no declarativeness in the language,the declarative part of the object description is discarded and only the realization of the object as a standard module persist. And in the language we add a dot syntax to access object properties. Name of the public object properties associated with the entry point of the module. To organize inheritance we introduces additional command Extend, in arguments of that all ancestors of this class is enumerated. Providing multiple inheritance of classes. But the event processing system is necessary to develop fully. To do this, in the language MSH have been added event processing commands:

These commands should be enough to handle the events. Events can be systemic. are those that are generated by the external environment. For example, the discovery of asynchronous device or RunTime error in the program. Events can be generated and the application with the command EventTrap, then this custom event. The necessary parameters are passed to the event processing as arguments.

Others changes in MSH language compared with MUMPS is not as principled, but nevertheless must improve its capabilities.Let's start with the data localization. In terms of the C language, as default, the locales is global. To localize the data, additional efforts are needed. This is bad.This is uncomfortable to include New command in each subroutinethe to protect the variables. If in each subroutine will included the New command, in the exclusive form, the formal parameters will be hidden and must be duplicated in the list command New.So, I decided to refuse this method of data localization.In MSH, there are several scopes of variables:

1. Variables are localized inside the subroutine call,2. Variables localized inside job3. Variables are localized within the application,4. The variables are located on external devices.

In the MSH as in MUMPS is no declaration of variables. To distinguish the scopes visibilities we had to use the only known and proven method of BASIC prefix variable.Variables localized within the application are prefixed with %%.Variables localized within the assignments are prefixed with %.Variables located on the external devices have the prefix ^.All other variables are localized inside the subroutine call.This will prevent the command New.

Now regarding the structure of the data. In MUMPS one data structure for locales and global - it's a tree. Variables can be indexed and non-indexed. But in the global exists such a concept as a shortened link. Shortened link greatly complicates the understanding of the program and its debugging. In addition, if a subroutine uses a shortened link, then this subroutine can not be used for local variables treatment. Which violates the integrity of the language MUMPS. Therefore shortened link in MSH is missing. To prevent the loss of MUMPS flexibility, it has such a construction as indirect syntax. Which allows you to use as a variable name another variable that contains the name of the first variable. Sounds a bit clumsily, and so is it inconvenient to use. This structure of MUMPS causes a lot of criticism, so in the structure of MSH it excluded. And in order not to lose the flexibility of the language, was decided to abandon the name of the variable and leave only the index. The first index is treated as a variable name. Of course, the tree structure of the data is very versatile. But it is certainly not optimal for speed access for simple, non-indexed variables. Therefore MSH added another data structure - a one-dimensional array of data.

We proceed to language commands.Arguments are separated from the command by a space. MUMPS has 2 types of syntactically different commands. In commands of the first type the next command separated from previous by space. In these commands, spaces are significant and extra spaces are not allowed. Its presence leads to a syntax error. If the command has no arguments, the command is followed with 2 spaces. Second type commands ends with the end of the line. There is a 3 such a commands: For, If, Else. In fact, these commands are used in a block with the other commands and so their syntax is different. Additionally, these commands unlike the first type commands has no conditions for their implementation. Altogether, these causes inconvenients of structured programs writing.In MSH applied different syntax strategy.First, introduced indication the end of the commands - ';'. Spaces are preserved as a separator between the command and arguments, but their number is now irrelevant.Second, the concept of block commands. The command of this type is the beginning of the block. And the end of the block is the End command. Execution condition of the command applies to all commands. Syntax becomes more uniform.Lock command.In the MUMPS Lock command is used in 2 ways: to lock and unlock. In the MSH command Lock divided into lock for reading, write locks and unlocks. In addition, for a time out locking is using system functions. Locks are used mainly for process synchronization and to synchronize data access in different jobs. In MSH synchronization to access data on external devices and level data application are made at the level of language. And it does't require additional commands for locking.The If command become the block command and must be terminated with Else, or End. This command has no arguments, and the command execution applies to the entire block. The command Else is used with the If command and may also have a execution condition. Then this command becomes to the ElseIf command. Else command is a block command and must be terminated by Else, or End. Command else has no arguments.Another block command is the command For. This command implements a loop. According to the content, MSH command For similar to the the C language. C command For has 3 arguments. 1st argument is cycle initialization. In MSH, this argument is excluded from the For command. The command Set initialize variables before the loop execution. 2nd C argument specifies the termination condition of cycle. In MSH termination condition transferred to the execution condition of For and End commands . This allowed to exlude commands of cycle While Loop and Do While , because cycle command operate these cycles without any arguments. In the MUMPS cycles is one inconvenient feature. Inside the cycle, it can be terminated by the Quit command. But the trouble is that for the termination of the the subprogram uses the same command, and to terminate the subprogramm inside the cycle is not possible. In MSH command Break uses as a cycle termination, and in subprogram termination uses the command Return. Quit command is excluded.My MUMPS programming experience showed that in 90% cases of using For command it is using for bypass the tree. And it's not the most comfortable command. It requires additional requests for data. Therefore in MSH put 3 commands of iterators and system function to bypass the tree.1. The Next command - bypassing one level of the tree from beginning to end,2. The Back command - bypassing one level of the tree from the end to the beginning,3. The Query command - bypass tree node to its full depth.In MUMPS is no such a useful command as Case. In MSH it's added in notation of Pascal language, which, it's seems to me, is more successful than in C. At the same time, variable of selection can be any type. Command Case in MSH is block command and terminates by the End command. Tags inside the unit are localized within the command .

In MUMPS it's no such a useful thing as a constant. So MSH adding a Const command.

To organize inheritance in MSH uses Extend command.In addition, the Include command is taken from C, which allows you to compose the text of program code from the various pieces.

In MSH modified system of parameters transmission to subroutines and functions. In MUMPS a subroutine entry point and labels are different in that the entry points have sometimes a list of formal parameters. A subroutine can be called by a label or label + offset. To pass the parameters in this case will not succeed. In general, the label can has no different from the entry points . This approach has no logic. Formal parameter list fixes it's number. In C was added the ability to transfer a variable number of actual parameters. There is no list of formal parameters in the MSH. To call a subroutines and functions going on with labels in the module with the transfer of the actual parameters in the traditional form. In subroutine actual parameters gets in a special array of arguments whose number is stored in the zeroth element of the array.

Also, added some operations, the most significant of which is the operation of choice in the syntax of the C language.

All this was done in order to create a modern, reliable, flexible programming language information systems.

Who is online

Users browsing this forum: No registered users and 1 guest

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