| View previous topic :: View next topic |
| Author |
Message |
Tuncay
Joined: 07 Nov 2006 Posts: 383 Location: Berlin
|
Posted: Mon Dec 10, 2007 9:43 pm Post subject: Strings accepted on byref parameters |
|
|
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 |
|
 |
ManaUser
Joined: 24 May 2007 Posts: 906
|
Posted: Mon Dec 10, 2007 10:57 pm Post subject: |
|
|
| 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 |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 383 Location: Berlin
|
Posted: Mon Dec 10, 2007 10:59 pm Post subject: |
|
|
| Quote: | | with defaults values are allowed now |
What is, if I want pass custom strings without to define a variable? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1397
|
Posted: Tue Dec 11, 2007 6:41 am Post subject: |
|
|
Is this really that hard to type?
| Code: | | msgbox % get(_:="Hello") |
|
|
| Back to top |
|
 |
Tuncay
Joined: 07 Nov 2006 Posts: 383 Location: Berlin
|
Posted: Tue Dec 11, 2007 10:13 pm Post subject: |
|
|
| 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 |
|
 |
HuBa
Joined: 24 Feb 2007 Posts: 172 Location: Budapest, Hungary
|
Posted: Tue Dec 11, 2007 10:25 pm Post subject: |
|
|
| Sean wrote: | | Code: | | msgbox % get(_:="Hello") |
|
OMG!
Nice to learn some new tricks  |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Wed Dec 12, 2007 2:52 am Post subject: |
|
|
| 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.  |
|
| Back to top |
|
 |
|