cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
] />

JMP Wish List

We want to hear your ideas for improving JMP. Share them here.
Choose Language Hide Translation Bar

2 functions for the 2 meanings of expr()

☑ cool new feature
☑ could help many users!    ("nobody" is using expression handling? - maybe ... why?)

☑ removes something that feels like a „bug“

☐ nice to have

☐ nobody needs it

 

#myTop10_2025

 

What inspired this wish list request? 

 

In JSL, Expr() is used for 2 purposes:
-  "it is here()" inside of Eval Expr()
I protect you()  - to protect the content from being evaluated


Unfortunately, Eval Expr() is  happy with the first Expr() and evaluates it.

This restricts the flexibility with which users can write nested expressions - see:

Returning an expression from a function differs when namespace is used.

TS-00235515

TS-00235798

 

 

What is the improvement you would like to see? 

Add 2 new functions to JMP for the 2 meanings of Expr():

-  "it is here()   *) " inside of Eval Expr()
I protect you() *)  - to protect the content from being evaluated

 

*) please use the comments to suggest optimized function names? 
- as short as possible

- as "telling" as possible    [Name Expr() is the ideal name for Name Expr() - for German speakers ...]

 

Together with the [legacy] Expr(), they should allow the user to write code much easier in JSL.

 

e.g. 
Eval Expr(protect( ....     Expr(expression to evaluate) ...) ...)

 

in the sense of 

Eval Expr(protect( ....     it is here(expression to evaluate) ...) ...)

 

Why is this idea important? 

the dual-use of Expr() it is harmful and makes code fragile and complicated.
Using separate names for the 2 meanings will fix the issue.

 

other wishes from hogi_2-1702196401638.png

6 Comments
Status changed to: Acknowledged

Thank you for submitting this request!

hogi
Level XIII
hogi
Level XIII

I am still unsure how to call Expr and Expr² - and if Eval Expr() needs  a double as well ... to fit to the double of Expr².

Eval(Eval Expr( Quote( Do Something With( This(my_expr) ) )))
Eval(Eval Expr( Protect( Do Something With( Inject(my_expr) ) )))
Eval(Eat Honeypot( Protect( Do Something With( Honeypot(my_expr) ) )))
hogi
Level XIII
Eval(Eval XXX( Protect( Do Something With( XXX(my_expr) ) )))
Eval(Eval That( Protect( Do Something With( That(my_expr) ) )))

This() would be perfect, right? - but it's already be used in the context of Classes.

hogi
Level XIII
Eval(Eval Name( Protect( Do Something With( Name(my_expr) ) )))

(c) @drewfoglia 
2x win:
-> this approach could fix the issue with Name() as well!

hogi
Level XIII

To see the benefit:

To replace the "offset" in this function with a predefined value:

f= function({y},
Expr(a + b);
Expr(y + offset))

with the new approach, one can write:

offset=5;
Eval( Eval That( f = Function( {y},
Expr(a + b);
Expr( y + That( offset ) ) ) ) )

 

With the current approach, one has to generate creative constructs like the one below - or use some other tricks:

Eval(
	Eval Expr( f = Function( {},
Expr(Expr(a + b);
Expr(Eval Expr( y + Expr( offset ) ) ) )) )