NetXMS Support Forum

English Support => Feature Requests => Topic started by: graeChris on February 13, 2024, 05:38:40 PM

Title: Suggestions for V5.0 Syntax Changes and Questions.
Post by: graeChris on February 13, 2024, 05:38:40 PM
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 (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




Title: Re: Suggestions for V5.0 Syntax Changes and Questions.
Post by: graeChris on February 13, 2024, 06:00:11 PM
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 (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

Tulkots no angļu valodas, izmantojot Google tulkotāju
Title: Re: Suggestions for V5.0 Syntax Changes and Questions.
Post by: Filipp Sudanov on February 14, 2024, 02:10:02 PM
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.
Title: Re: Suggestions for V5.0 Syntax Changes and Questions.
Post by: graeChris on February 14, 2024, 04:32:35 PM
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.