AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

More Options in Function Parameters

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Ian



Joined: 15 Jul 2007
Posts: 1077
Location: Enterprise, Alabama

PostPosted: Mon May 12, 2008 1:55 am    Post subject: More Options in Function Parameters Reply with quote

Something like this:

Code:
function(num x, alp y)


Where num is a number and alp is an alpha char(s).
_________________
1,000 Posts achieved on Saturday April 26, 2008 1:45 am
Back to top
View user's profile Send private message
Superfraggle



Joined: 02 Nov 2004
Posts: 753
Location: London, UK

PostPosted: Mon May 12, 2008 1:57 am    Post subject: Reply with quote

Why???

What benefit would this have. Apart from limiting what is sent to the function, but then seeing as you are calling the function, its down to you to make sure you send the correct info.
_________________
Steve F AKA Superfraggle

http://r.yuwie.com/superfraggle
Back to top
View user's profile Send private message MSN Messenger
TheIrishThug



Joined: 19 Mar 2006
Posts: 347

PostPosted: Mon May 12, 2008 2:10 pm    Post subject: Reply with quote

If you are writing a library it may not be you who is calling the functions. It would allow AutoHotkey's internals to do some type checking and not force programmers to bog-down their functions with them.

Rule #1: Never trust user input. I try to do the same even when I'm likely to be the only person to use my code.
Back to top
View user's profile Send private message Visit poster's website AIM Address
jballi



Joined: 01 Oct 2005
Posts: 297
Location: Texas, USA

PostPosted: Mon May 12, 2008 8:46 pm    Post subject: Reply with quote

I find it very difficult to believe that I'm sticking my foot in this topic!

It appears that this "feature" has limited value unless you are able to (forced to?) assign a data type to all variables, not just function parameters. Without it, most errors would only be discovered at run-time.

Example: User enters '123' to a variable which is passed to function -- No problem. User enters 'ABC' to a variable which is passed to function -- Run-time 'Data type' failure!

Yes, the error message would improve debugging but the value is significantly diminished without a compile-time error.

Them be my thoughts...
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2359
Location: Australia, Qld

PostPosted: Mon May 12, 2008 9:53 pm    Post subject: Reply with quote

jballi wrote:
Yes, the error message would improve debugging but the value is significantly diminished without a compile-time error.
I agree, especially since the same effect can be achieved with hardly any more code in each function:
Code:
function(x, y) {
    num(x), alp(y)
; or
    test_params("num", x, "alp", y)
    ;...
}
Of course, someone would need to write the functions. Preferably someone that sees value in the idea...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group