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 

Strings accepted on byref parameters

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



Joined: 07 Nov 2006
Posts: 383
Location: Berlin

PostPosted: Mon Dec 10, 2007 9:43 pm    Post subject: Strings accepted on byref parameters Reply with quote

Why not accepting strings directly in functions with byref parameter, like optional one?
This cannot break any existing script, because strings on byrefs are currently a violation.

AutoHotkey could create inside the function a temporary variable initialized with the given string.

Example:
Code:
; wish: strings accepted on byref parameters

msgbox % get("Hello") ; Should return "Hello World!".

get(byref m)
{
    m .= " World!"
    Return m
}
Back to top
View user's profile Send private message Send e-mail
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Mon Dec 10, 2007 10:57 pm    Post subject: Reply with quote

I agree. I can't think of any reason this shouldn't be allowed since byref parameters with with defaults values are allowed now.
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 383
Location: Berlin

PostPosted: Mon Dec 10, 2007 10:59 pm    Post subject: Reply with quote

Quote:
with defaults values are allowed now

What is, if I want pass custom strings without to define a variable?
Back to top
View user's profile Send private message Send e-mail
Lexikos



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

PostPosted: Tue Dec 11, 2007 12:10 am    Post subject: Reply with quote

Allow expressions to be passed to ByRef functions
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1397

PostPosted: Tue Dec 11, 2007 6:41 am    Post subject: Reply with quote

Is this really that hard to type?
Code:
msgbox % get(_:="Hello")
Back to top
View user's profile Send private message
Tuncay



Joined: 07 Nov 2006
Posts: 383
Location: Berlin

PostPosted: Tue Dec 11, 2007 10:13 pm    Post subject: Reply with quote

Tuncay wrote:
Quote:
with defaults values are allowed now

What is, if I want pass custom strings without to define a variable?


Sorry I misread something, please ignore this post of me!!!!

Sean, no, it isnt that hard. But users of that function may not know, that is a byref var and it is a little bit fever to write. I dont want to think back if the param is byref or not.
Back to top
View user's profile Send private message Send e-mail
HuBa



Joined: 24 Feb 2007
Posts: 172
Location: Budapest, Hungary

PostPosted: Tue Dec 11, 2007 10:25 pm    Post subject: Reply with quote

Sean wrote:
Code:
msgbox % get(_:="Hello")

OMG!
Nice to learn some new tricks Smile
Back to top
View user's profile Send private message Visit poster's website
Lexikos



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

PostPosted: Wed Dec 12, 2007 2:52 am    Post subject: Reply with quote

Tuncay wrote:
I dont want to think back if the param is byref or not.
You don't need to. AutoHotkey will yell it at you when you try to run the script. Razz
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