Jump to content

Implement optional ByRef parameters for functions


Recommended Posts

That's thanks to @trancexx who reopened my eyes.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Just now, czardas said:

The ByRef part can also be optional. Therefore, if no argument is given and no global variable exists, then a local variable is created.

Basically that is what I said in a nutshell :D

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

  • 2 weeks later...

I do not support this behavior. I support the idea of an optional ByRef parameter. But I do not support the second part of the idea proposed here - that a local variable will be created.

what i think that supposed to happen is that the variable will be ignored completely

Edited by Guest
Link to comment
Share on other sites

5 hours ago, gil900 said:

what i think that supposed to happen is that the variable will be ignored completely

Why do you think that it is better than my suggestion of creating a Local variable? :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

8 hours ago, gil900 said:

what i think that supposed to happen is that the variable will be ignored completely

If you define a default value for a function parameter, a variable has to be created. If you pass a literal value to a ByRef parameter, then either you create a local variable or you throw an error: you shouldn't just ignore it. There are several advantages to allowing literals to be passed ByRef to function parameters with (or without) defined default values: the concept being flexible and robust. On the other hand, not allowing it seems to offer little advantage.

Such a change is unlikely to be script breaking, but it might produce some unexpected side effects - fixing scripts that are currently broken. :idiot:

Edited by czardas
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...