Comment lines are parsed?

I put the following comment line in one of my methods:```
// the questionmarks refer to the array (3rd parameter) in “getDataSetByQuery” function


> function keyword found in this script

If I mispell "function" to "functin" the script clears.

Would appear to be a recent change. Confirmed. I've performed a search for "function" in all methods and have found several in methods dating back to last summer, all in comment lines.

Is that right, that comment lines are parsed? Surprised.

Hi Morley,

I found this issue in older versions as well. So I am surprised you have methods with comments that have the word ‘function’ in them as well.
I guess the following thread is related:

http://forum.servoy.com/viewtopic.php?t=3697

So what version of Servoy are you using?

ROCLASI:
So what version of Servoy are you using?

2.2rc1 build 319

Me too. I used the function keyword in a comment with no problem until R2 2.2rc1-build 319. I guess this is really a fix as comments didn 't “hide” stuff like turning “for” blue. Of course, this is all easy to remedy with the nice search and replace, but …

real javascript function support would be nice to have…

bob cart:
real javascript function support would be nice to have…

I guess it can’t because Servoy methods are real javascript functions.

ROCLASI:

bob cart:
real javascript function support would be nice to have…

I guess it can’t because Servoy methods are real javascript functions.

What I was talking about was the function keyword like

function myfunction(arg1,arg2){
my expressions
}

Methods are tied to forms or are globals so they increase the growing list of resources to look through in the editor. This is sometimes overkill for a simple function you might often need. I’m talking more about the type of functions shown with the “fx” in the editor. We have modules and of course a plugin interface to build our own stuff, but none of these are quick and easy. You can call and even nest javascript functions in one block of code… Anyway, I’m not complaining and I understand why this doesn’t fit the SOM, but nonetheless, if ‘function’ was supported, I’d use it.

In a sense you can do that now with version 2.2.
Just make a module with only global methods (your functions) and load them into your solutions when you need them.

ROCLASI:
In a sense you can do that now with version 2.2.
Just make a module with only global methods (your functions) and load them into your solutions when you need them.

Um, yeah, that’s what I just said above. :wink:

However, sometimes on longer methods it would be nice to be able to use functions so you don’t have to create any other nodes in the designer, i.e. fewer globals, methods, forms, etc makes the solution cleaner and easier to maintain. Sometimes longer more complex methods need to repeat code for finding and sorting when a function with simple args would make things easier and cleaner. I usually think about it for a few seconds before creating yet another method rather than just writing the code in place. The functions I’m talking about would run only within the scope of a method. I’m not sure how you’d reference a function within a method from another method maybe methodname().functionname() - but the added complexity is probably why we don’t get to use them.

bob cart:

ROCLASI:
In a sense you can do that now with version 2.2.
Just make a module with only global methods (your functions) and load them into your solutions when you need them.

Um, yeah, that’s what I just said above. :wink:

Reading back I see you did. :oops:
Sorry about that.

bob cart:
However, sometimes on longer methods it would be nice to be able to use functions so you don’t have to create any other nodes in the designer, i.e. fewer globals, methods, forms, etc makes the solution cleaner and easier to maintain. Sometimes longer more complex methods need to repeat code for finding and sorting when a function with simple args would make things easier and cleaner. I usually think about it for a few seconds before creating yet another method rather than just writing the code in place. The functions I’m talking about would run only within the scope of a method. I’m not sure how you’d reference a function within a method from another method maybe methodname().functionname() - but the added complexity is probably why we don’t get to use them.

Functions inside functions can be very handy and reduce code/method nodes. But I don’t think it necessarily makes things easier to maintain though.
Also I don’t see how functions in methods will reduce anything else than methods.

Calling functions in other methods would also need some way of knowing what (sub) functions there are in those methods. Thus more (sub) nodes in the editor tree.
Why not make it easier and have a way of grouping method nodes into sub-nodes. I think that is easier to implement by the dev team.

Why not make it easier and have a way of grouping method nodes into sub-nodes. I think that is easier to implement by the dev team.

That’s a good idea. Please do post that feature request if it hasn’t been done yet. I assume they extend the JdbTreeView bean to do this so it certainly seem doable. Another way would be to organize modules in their own tree, but that would also get unwieldy when you opened a tree. My current solution is already a bit long listed and I fear I only have about half of the resources I will need.

For that matter, I’d like to see form properties in a tree perhaps grouped into categories like format and events when more than say two or three of these node types are present. That would allow my windows to be smaller esp. when developing with multiple instances of servoy dev running.