Written by

Question Alin Soare 路 Apr 23, 2024

Internal of ObjectScript -- source code of Standard Library

Hello,

I am interested about reading the source code of the primitives of the system.  For example, I want to see how WRITE is implemented.

Can you help me to get a reflexive interrogation of the system ?

Kind regards,

Alin C Soare.

$ZV: IRIS 2024.1 for Windows 10

Comments

Luc Morningstar 路 Apr 23, 2024

IRIS is  NOT Open Source.
You may apply for engineering or support.
If you are hired  you eventually may get some access to some source
Up to that you just have public documentation

馃槇

0
Sylvain Guilbaud 路 Apr 23, 2024

Hello @Alin Soare,

Can you give us more details on your needs and what you are unable to do?

The WRITE command  is part of the basic instructions of IRIS (and even since the origin of the MUMPS language, pre-existing Cach茅, Ensemble, IRIS).

0
Alin Soare  Apr 23, 2024 to Sylvain Guilbaud

Hi,

The WRITE command, when passed no argument, does a reflexion on the system. I am not particularly interested about WRITE, but  I want to learn how to do self-reflection on the system, to find out the system status, and for this the best source of inspiration could be the system itself.  Apart from that, the source code of the system could be a source of inspiration for my own programs as well...  Something like that Lisp or Smalltalk programmers do all the time...

0
Enrico Parisi  Apr 23, 2024 to Alin Soare

The WRITE command, when passed no argument, does a reflexion on the system.

Well, it simply list/write all defined variables in current stack level, something you can perform using standard Object Script commands and functions, no need to look at Write source code.

To do that you can use $order,  $query, and indirection, with some trick needed for the variables you use to perform the listing, or, maybe simpler, you can use output redirection (to a string for example) and then...well, an argument less Write command 馃槉

Some hint for the first option:

USER>set a=1,b=2,b(1)=3,x=""
 
USER>set x=$order(@x)
 
USER>write x
a
USER>set x=$order(@x)
 
USER>write x
b
USER>set x=$query(@x)
 
USER>w x
b(1)

For output redirection, see IO Redirect in ObjectScript in Open Exchange.

0
Alin Soare  Apr 23, 2024 to Enrico Parisi

Thank you.  My point is, when I want to do something that I know that a predefined function already does, how can I get inspiration from its code about how to reproduce that behavior myself ?  

On the other hand, are you sure that your method is that same that WRITE uses to interrogate the environment ?

0
Enrico Parisi  Apr 23, 2024 to Alin Soare

On the other hand, are you sure that your method is that same that WRITE uses to interrogate the environment ?

Why should I care? Why do you care?

0
John Murray  Apr 24, 2024 to Alin Soare

when I want to do something that I know that a predefined function already does, how can I get inspiration from its code

When the product isn't Open Source, you probably can't.

0
Robert Cemper 路 Apr 23, 2024

System Utility %ETN.int takes a snapshot with all actual variables somehow similar to WRITE command
Description:  Using %ETN
It may give you some feeling how to analyze a running process.
ATTENTION
reading requires some experience in ObjectScript
you might get lost

0
Alin Soare 路 Jun 10, 2024


USER>s x=1, y=2, z=3, %="%"
USER>for {set % = $order(@%) quit:(%="")   w !,%," ",@% }
 
x 1
y 2
z 3

0