cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Advanced syntax highlighting in JSL Editor - does the function evaluate its argument?

☑ cool new feature
☑ could help many users!

☑ removes something that feels like a „bug“

☐ nice to have

☐ nobody needs it

 

#myTop10_2024 

 

Short: 

Let JSL Editor show which function evaluates it's arguments and which function doesn't!

 

Long:

 

What inspired this wish list request? 

There is a very powerful behavior in JSL which, on the other hand, makes it difficult for new users to get started without hiccups:

Some Functions evaluate their arguments and others don't.

 

This is very important for functions which are used for expression handling.

There is a wonderful lecture by @joseph_morgan : Using JSL to Develop Efficient, Robust Applications (EU 2018 415) on the differences, how to live with them and how to use them to develop efficient and robust applications.


hogi_0-1709472559995.png 


...  describing the status at that time: Jmp 14 [2018]:
This doesn't exist in the documentation.
This is something I figured out [ ] by reverse engineering the behavior of expression handling functions.
Trust me, [ ] if you do not think of these functions in this you will never get them right.

 

Besides the expression handling functions listed here, the same holds for all function:

if you do not think of these functions in this you will never get them right:

It's highly important to know if an argument gets evaluated before the function call of not.

 

Does this code work or doesn't it?!?

dt = Expr(current data table());
myscript = Expr(get script());

dt << myscript

 

Unfortunately, for the JSL scripter there is no hint how the function behaves - does it evaluate its arguments or not?

Maybe it just evaluates one of the arguments? Who knows?

The user has to know!

... or: reverse engineering the behavior of the respective functions.

 

What is the improvement you would like to see? 

Please implement some syntax highlighting to indicate the different ways a function evaluates - or doesn't evaluate its arguments.

Add-On: Please also indicate the difference in the Scripting index. 

 

hogi_1-1709475554170.png

 

In JSL editor, the highlighting can be activated/deactivated via a keyboard shortcut.

 

The Expr(_x_^2) show kind of dilemma:
the argument of Expr () doesn't get evaluated. But the two arguments of ^ would get evaluated.

Maybe the highlighting reacts on the position of the mouse or cursor -  just the arguments below the branch are highlighted where the mouse/cursor is currently located.

 

Why is this idea important? 

With the new syntax highlighting, JMP will guide the user automatically to generate the right code.

The user doesn't have to run the code to get an error message - or to see the wrong result

... or to reverse engineer the function - like @JosephMorgan had to do to prepare his paper.

 

other wishes from hogi_2-1702196401638.png

5 Comments
hogi
Level XII

Seems that between 

1) argument gets evaluated

2) argument doesn't get evaluated

 

there is a third variant:
1b) the argument is evaluated "once"
functions which behave this way:
- Head

- Recode Column (1st argument and argument of the Target Column() argument

- ... ?

 

So, a third color will be necessary.

 

dt = Open("$SAMPLE_DATA/Big Class.jmp");
col = Name Expr(As Column("name"));

Head(As Column("name"));
Head(col);

dt << Recode Column(AsColumn("name"),{1},Target Column(col));

Does Head evaluate its argument? 

https://community.jmp.com/t5/Discussions/Begin-Data-Update/m-p/753037/highlight/true#M93483 

 

 

hogi
Level XII

...  describing the status at that time: Jmp 14 [2018]:
This doesn't exist in the documentation.
This is something I figured out [ ] by reverse engineering the behavior of expression handling functions.
Trust me, [ ] if you do not think of these functions in this you will never get them right.

 


Status now, Jmp18 (2024):

hogi_0-1715358870868.png

 

hogi
Level XII

Hm, there are still some issues which might not be solved by advanced syntax highlighting ...

 

e.g.

from the printed "2" one can see that JMP actually evaluates the argument of the Set File List setting - 3 times !?!
... but at the end, it complains about the "print" ?!?
... and without the print it won't do anything, neither complain nor open the file from filelist.

 

folder= "$SAMPLE_DATA/../Import Data/";
file= "Animals.txt";
filelist= Eval List({folder||file});

Multiple File Import(
	<<Set Folder( Print(1);folder ),
	<<Set Use File List( 0 ),
	<<Set Name Filter( Print(3);file ),
	<<Set Name Enable( 1 )
) << Import Data;

Multiple File Import(
	<<Set Use File List( 1 ),
	<<Set File List( print(2); filelist )
) << Import Data;

hogi_0-1720645070503.png

 

TS-00152969:

I've spoken with Development about the issue. The issue is a defect and I have reported it to Development so it can be resolved in a future JMP version.

many thanks -> fixed in JMP19EA5

Status changed to: Acknowledged
 
hogi
Level XII

Thank you, @Sarah-Sylvestre