Jump to content

AutoIt v3.3.13.11 Beta


Jon
 Share

Recommended Posts

It was done because people were abusing the fact that Default evaluated to -1.  Passing Default to GUI controls, and created functions that took a numeric parameter and checking for -1 rather than explicitly checking for Default. Or the other way around and checking for Default but the user passing -1.

Any evaluation of a number to try and guess if it is Default is wrong. Apart from triggering a fatal error, the only sensible number we can assign is 0. Not because it is more likely to be significant (it's not, -1 is more abnormal) but because it is more likely to be confused with an actual 0. That makes it more likely that the only sensible use of Default is to indicate one thing, the Default keyword.

The correct use of testing for Default is:

If $something = Default

This will never fail because the user passed a number instead. 

 

I appreciate you taking time to explain this Jon. I didn't mean to come across as being critical. I understand your decision better now. I really just wanted to understand it to avoid making mistakes in my own design choices. Thanks.

Edited by czardas
Link to comment
Share on other sites

What if Default gives the optional params of a function their optional value?

 

You may wish to assign a default optional value using a function call. That function could be anything (based on conditions), and it may complicate things too much - both to implement and for beginners to work with. I would say it is currently very flexible, even if it is slightly verbose.

Edited by czardas
Link to comment
Share on other sites

eukalyptus,

I've proposed that several times but received little interest and even rebutal. I can't get why Default shouldn't work this way.

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

But could it be made to work flexibly like this?

:

Func ConditionalDefault($vDefault = 0xFFFFFFFF)
    Local $iCondition = Random(0, 1, 1)
    
    Switch $iCondition
        Case 0
            If $vDefault = Default Then $vDefault = FalseCondition()
        Case 1
            If $vDefault <> Default Then $vDefault = TrueCondition()
    EndSwitch
    ; some code
EndFunc ;==> ConditionalDefault
Edited by czardas
Link to comment
Share on other sites

Correct! That's why SQL IsNull (and IsNotNull) is useful.

Edited by jchd

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

$a could also be NaN or ±Infinity. Floating point non-numbers don't equal themselves either.

Infinity can be compared without issue.

You are right about NaN though. In reality, why you'd have a situation where you weren't sure if a variable was Null or NaN I don't know. 

Link to comment
Share on other sites

Indeed I didn't check +/- Inf. Maybe that depends on some flag setting in the FP unit but I won't check further.

Anyway If $x = Null works everytime and is both clearer and simpler than If IsKeyword($x) = 2.

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

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...