Kappa-Dev/KappaTools

Inconsistent behavior in snapshot naming between KaSimInBrowser and KaSimInCommandLine for `[E]`

Closed this issue · 4 comments

Using the toy example:

%mod: [true] do $SNAPSHOT "snap_".[E].".ka" [true]; repeat [true]

%agent: timer(s{tik tok})	%init: 1 timer()
timer(s{tik}) <-> timer(s{tok}) @ 1, 1
%mod: [E] = 5 do $STOP ;

KaSimInBrowser names snapshots like snap_[E].ka, snap_[E]_1.ka, whereas
KaSimInCommandLine names snapshots like snap_0.ka, snap_1.ka, properly using the [E] symbol for event number.

feret commented

In the following example,
%mod: [true] do $SNAPSHOT "snap_".[E].".ka" ;
%mod: [true] do $SNAPSHOT "snap_"."[E]".".ka" ;
both lines are translated the same way in json.

It is important to distinguish macro, from raw strings.

feret commented

I have added a term constructor to distinguish algebraic constructor from regular strings.

feret commented

@hmedina I have committed a tentative fix in the branch distinguish_algexpr_in_json.
Could you check that it is answering your concern ?
If so, I will merge in the main branch.

I didn't see a way of building a Windows executable KappApp, so I tested against building site/index.html, and ./_build/install/default/bin/WebSim, and the snapshots are named as expected.

Using [E] uses the simulator's event number, [T] the simulator's time, [Tsim] the host's time spent, and [E-] the number of null events; where appropriate, files got _n suffixes to prevent name clashes, as is expected.