czardas Posted April 18, 2017 Share Posted April 18, 2017 Null is not a variable, so your example has only a vague association with my comment which you quoted above. You are doing something which has not been documented, and the behaviour you are seeing is perhaps the result of some internal code which has somehow avoided the radar of detection. There's something going on and we don't know what it is. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Guest Posted April 18, 2017 Share Posted April 18, 2017 (edited) I think I get it - If I pass non-variable then it allocate new memory. otherwise it will reference to the source variable.correct?Which seemed odd to me is why it accepted non-variable at the first place.. so jchd said that it was a " a feature request already made".. I don't know what is the point of this feature.. Now I understand correctly the story? Edited April 18, 2017 by Guest Link to comment Share on other sites More sharing options...
jchd Posted April 18, 2017 Share Posted April 18, 2017 No, I referred to a recent post about optional ByRef args, see this ticket https://www.autoitscript.com/trac/autoit/ticket/3540 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
TheDcoder Posted April 18, 2017 Share Posted April 18, 2017 Rings some bells 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 More sharing options...
Guest Posted April 18, 2017 Share Posted April 18, 2017 5 hours ago, jchd said: No, I referred to a recent post about optional ByRef args, see this ticket https://www.autoitscript.com/trac/autoit/ticket/3540 What about this: Quote If I pass non-variable then it allocate new memory. otherwise it will reference to the source variable.correct? Link to comment Share on other sites More sharing options...
jchd Posted April 19, 2017 Share Posted April 19, 2017 Of course that's correct. Else how do you think you could "pass something" without allocating memory? C and friends use the program stack, AutoIt allocates a hidden variable (variant) for storing the "non-variable" (here I interpret that term as "a literal"). In all cases you have to store a value in a chunk of memory to pass it away. Few programming languages rely entirely on white magic. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Guest Posted April 19, 2017 Share Posted April 19, 2017 Yes, I know it must be true .. I just asked anyway in case there is a magical surprise Link to comment Share on other sites More sharing options...
trancexx Posted April 20, 2017 Share Posted April 20, 2017 The interpreter works like this (line by line): ; I am the interpreter! SomeFunc(Null) ; I need to call SomeFunc. First let me check that the function exist. Oh great, it does, found it in list of all functions that I created at the beginning! ; Ok I need to create the list of arguments for this call, the user is passing one parameter. ; The list of arguments will therefore have one member. ; Let me first create unnamed variable (because user passes literal) with value of Null. Done! ; Time for the list of arguments... ; Hm, I see that inside definition of SomeFunc the first argument is ByRef, so I'll add reference to the unnamed variable I created moment ago to the list. Dang bang... done! ; Calling the function now. Func SomeFunc(ByRef $Output) ; I'm inside a function and I have one local variable named $Output to work with plus no global variables. This $Output is ByRef, so ; I won't be allocating anything. $Output = 1 ; The user is changing the value of $Output variable. I see that $Output is reference. Accessing the original variable... changing... Done! ;... ConsoleWrite($Output & ' (L: ' & @ScriptLineNumber & ')' & @CRLF) ; This will print 1 EndFunc More clear? czardas 1 ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
czardas Posted April 20, 2017 Share Posted April 20, 2017 (edited) So to get an optional ByRef parameter, all you have to do is alter this part. ; Let me first create unnamed variable (because user passes literal) with value of Null. Done! ; Let me first create unnamed variable (because user passes nothing) with value of nothing. Done! ; Edit - I forgot to include the next line. ; Assign default value to unnamed variable. Done! Is that right? Edited April 20, 2017 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
jchd Posted April 20, 2017 Share Posted April 20, 2017 @trancexx thanks for confirmation. @czardas, no I think the number of parameters will be 0 (parameter list empty) and no unnamed variable will get created at call time. Only inside the callee will one (or more) temp variable(s) be created with its/their default value, due to the difference of the number of parameters declared and the number of arguments actually passed. And I guess that in this case their ByRef attributes will be simply ignored, since it make zero difference. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
czardas Posted April 20, 2017 Share Posted April 20, 2017 (edited) What you just said reminded me of this song: https://www.youtube.com/watch?v=OFgayzZ5KTM I think it fits the description - from the variable's perspective. Edited April 20, 2017 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
GogoTraining Posted May 1, 2017 Share Posted May 1, 2017 ByRef parameters are certainly a useful concept but they are not currently available in AutoIt. Link to comment Share on other sites More sharing options...
jchd Posted May 1, 2017 Share Posted May 1, 2017 @GogoTraining, Care to reconsider? 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
TheDcoder Posted May 1, 2017 Share Posted May 1, 2017 1 hour ago, GogoTraining said: ByRef parameters are certainly a useful concept but they are not currently available in AutoIt. https://www.autoitscript.com/autoit3/docs/keywords/Func.htm 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 More sharing options...
GogoTraining Posted May 24, 2017 Share Posted May 24, 2017 I expected it to crash or at leas not to compile and run.. Link to comment Share on other sites More sharing options...
jchd Posted May 24, 2017 Share Posted May 24, 2017 It's all about language specifications, not divination, preference, expectation or belief. 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now