You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working with JaCaMo, I found this bug: there is no validation in createLiteral to check whether the given string is actually acceptable. If you try the following code:
Literala = createLiteral("a(b)");
The code creates a literal with the functor a(b). I know that parseLiteral also exists, and given the same string, it correctly creates the literal, but I find it strange that createLiteral does not throw an exception in such cases.
Additionally, from the Mind Inspector's graphical interface, there is (obviously) no visual difference between a(b) (where the entire string is the functor) and a(b) (where a is the functor and b is the argument). This leads to an unpleasant debugging situation where the beliefs contain a(b) (or multiple instances of it, since for some reason also equal functors are not viewed as equals from the point of view of the agent BeliefBase), and a plan like the one below does not get executed:
+!hello
: a(b)
<- .print( "Hello!" ).
Perhaps parentheses are not the only characters that should be checked, but I consider them the most important because, theoretically, the functor should not be able to create functors with parentheses at all.
In case you find this issue interesting but don't have time to address it, I am available to try to implement this validation.
Thank you for your work!
The text was updated successfully, but these errors were encountered:
The idea of having two methods, createLiteral and parseLiteral, is to give to user the freedom to use whatever functor he/she wants. If checks are necessary, parseLiteral should be used. For an example, in some application, empty space "" could be used as functor to have a kind of tuples :-)
Another note, any string can be used (and parsed!) as functor when enclosed by ` and `. For example, what follows is syntactically valid code:
While working with JaCaMo, I found this bug: there is no validation in
createLiteral
to check whether the given string is actually acceptable. If you try the following code:The code creates a literal with the functor
a(b)
. I know thatparseLiteral
also exists, and given the same string, it correctly creates the literal, but I find it strange thatcreateLiteral
does not throw an exception in such cases.Additionally, from the Mind Inspector's graphical interface, there is (obviously) no visual difference between
a(b)
(where the entire string is the functor) anda(b)
(wherea
is the functor andb
is the argument). This leads to an unpleasant debugging situation where the beliefs containa(b)
(or multiple instances of it, since for some reason also equal functors are not viewed as equals from the point of view of the agent BeliefBase), and a plan like the one below does not get executed:Perhaps parentheses are not the only characters that should be checked, but I consider them the most important because, theoretically, the functor should not be able to create functors with parentheses at all.
In case you find this issue interesting but don't have time to address it, I am available to try to implement this validation.
Thank you for your work!
The text was updated successfully, but these errors were encountered: