Suggestions for V5.0 Syntax Changes and Questions.

Started by graeChris, February 13, 2024, 05:38:40 PM

Previous topic - Next topic

graeChris

Hello NetXMS Team,

I'm not sure if it's too late, but I was hoping to give some suggestions for V5.0 Syntax changes with regards to 

https://track.radensolutions.com/issue/NX-2343

String Concatenation - Feature Request
I would suggest changing concatenation to "+" instead of ".." if possible. This is how Python concatenates strings and I think it would lead to less problems with the change to the way accessing attributes and methods looks like it's going to change. A check for data type could be run and if the type is a string the "+" would concatenate, and if the type is a number, it would perform the addition function.


I like using "." instead of "->" for attributes and methods as it feels more like Python to me. ( I like python if you can't tell.) 

Questions
Will there be a transition period to give time for us to migrate existing scripts and filters to the new syntax? 
For example, with string concatenation, adding either the ".." or "+" as the preferred and documented way of performing string concatenation. 

Feature Requests
  • Add a warning to the compile function letting people know they have code that will be broken in future releases that needs to be updated.
  • Add a warning popup on client startup that lets us know we have code that will be broken in future releases.
  • Add a tool to the Tools tab that will check each script for deprecated code and provide a list of scripts and where they are located. For Example: "EPP Rule #21 has one or more deprecated method calls in Filtering Script"





graeChris

Labdien, NetXMS komanda!

Es neesmu pārliecināts, vai nav par vēlu, bet es cerēju sniegt dažus ieteikumus V5.0 sintakses izmaiņām saistībā ar:

https://track.radensolutions.com/issue/NX-2343

Virknes savienošana — funkcijas pieprasījums
Ja iespējams, es ieteiktu mainīt saiti uz "+", nevis ".". Šādi Python saista virknes, un es domāju, ka tas radītu mazāk problēmu, mainot veidu, kā piekļūt atribūtiem un metodēm izskatās, ka tas mainīsies. Var palaist datu tipa pārbaudi, un, ja tips ir virkne, "+" tiks savienots, un, ja tips ir skaitlis, tas veiktu pievienošanas funkciju.


Man patīk lietot "." "->" vietā atribūtiem un metodēm, jo tas man šķiet vairāk kā Python. (Man patīk python, ja jūs nevarat pateikt.)

Jautājumi
Vai būs pārejas periods, lai mēs varētu migrēt esošos skriptus un filtrus uz jauno sintaksi?
Piemēram, ar virkņu savienošanu, pievienojot ".." vai "+" kā vēlamo un dokumentēto veidu virkņu savienošanai.

Funkciju pieprasījumi
  • Pievienojiet brīdinājumu kompilēšanas funkcijai, lai cilvēki zinātu, ka viņiem ir kods, kas tiks bojāts turpmākajos laidienos, kas ir jāatjaunina.
  • Pievienojiet brīdinājuma uznirstošo logu klienta startēšanas laikā, kas informē, ka mums ir kods, kas tiks bojāts turpmākajos laidienos.
  • Pievienojiet rīku cilnei Rīki, kas pārbaudīs, vai katrā skriptā nav novecojuša koda, un nodrošinās skriptu sarakstu un to atrašanās vietu. Piemēram: "EPP noteikumam Nr. 21 ir viens vai vairāki novecojuši metožu izsaukumi filtrēšanas skriptā"

Tulkots no angļu valodas, izmantojot Google tulkotāju

Filipp Sudanov

Developers of NXSL may say in more details, but as far as I understand, the problem is that NXSL is loosely-typed language. So if you run this:
a = 33;
println(typeof(a));
a = "33";
println(typeof(a));

you'll see that when string contains only numbers, it's type is automatically converted to integer. Given that, using + both for addition and concatenation is problematic.

To add, since some time ago there are f-strings, e.g.:

value = 123;
println( f"The value is: {value}" );

so the need for concatenation might be not so high.

.. is already working for concatenation in v. 4.5. It's planned to have automatic conversion when migrating to 5.0 that would go through all scripts and change them.

In 5.0 there are compilation warning on use of deprecated functions, but these only present in script editor. The were some plans to check scripts everywhere in the system for deprecated functions, I will check later.

graeChris

Hi Filipp, Thank you for the clarification! That makes me less stressed out. I was getting worried I would have to rewrite everything I've written so far.