Jump to content

Recommended Posts

  • Moderators
Posted

jguinch,

I am quite surprised that you say it used to work - I seem to remember this being discussed some time ago and the general consensus at the time was that such behaviour was not a good idea. So I would say: "feature", not "bug"

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Of course it worked. The feature was controlled by Opt("MustDeclareVars").

This is script breaking change, which apparently isn't documented. If there was "general consensus" on this, then I question the ability of participants to make decisions like that.

♡♡♡

.

eMyvnE

  • Moderators
Posted

jguinch,

It seems my memory was not correct in this instance - sorry to have misled you.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted (edited)
  On 12/31/2015 at 1:20 PM, jguinch said:

Ahh, note it is possible do use something like this to skip this restriction :

Local $a = [1, Execute("$a[0]") ]

That isn't a viable solution because Execute() interprets the input as if it were a string - who knows what kind of data that will return.

I also have to agree with trancexx: it seems odd that this doesn't simply work out of the box. I am surprised that this (apparently logical) syntax no longer works.

Edited by czardas
Posted

Yes czardas, I tought about that. I made some tests before my previous post and it seems to be not so bad : 

#include <Array.au3>

Local $b = [1, "a", ObjCreate("shell.application"), WinList(), True, Binary("0x00204060") , DllStructCreate("int;"), WinGetHandle("[ACTIVE]"), MsgBox, 3.14159, 50, _ 
            Execute("$b[0]"), Execute("$b[1]"), Execute("$b[2]"), Execute("$b[3]"), Execute("$b[4]"), Execute("$b[5]"), Execute("$b[6]"), Execute("$b[7]"), Execute("$b[8]"), Execute("$b[9]") ]


ConsoleWrite("$b[11] is an integer ? "  & IsInt($b[11]) & @CRLF)
ConsoleWrite("$b[12] is a string ? "    & IsString($b[12]) & @CRLF)
ConsoleWrite("$b[13] is an object ? "   & IsObj($b[13]) & @CRLF)
ConsoleWrite("$b[14] is an array ? "    & IsArray($b[14]) & @CRLF)
ConsoleWrite("$b[15] is boolean ? "     & IsBool($b[15]) & @CRLF)
ConsoleWrite("$b[16] is binary ? "      & IsBinary($b[16]) & @CRLF)
ConsoleWrite("$b[17] is a structure ? " & IsDllStruct($b[17]) & @CRLF)
ConsoleWrite("$b[18] is a handle ? "    & IsHWnd($b[18]) & @CRLF)
ConsoleWrite("$b[18] is pointer ? "     & IsPtr($b[18]) & @CRLF)
ConsoleWrite("$b[19] is function ? "    & IsFunc($b[19]) & @CRLF)
ConsoleWrite("$b[20] is float ? "       & IsFloat($b[20]) & @CRLF)
ConsoleWrite("$b[21] is number ? "      & IsNumber($b[21]) & @CRLF)

_ArrayDisplay($b)

 

Posted (edited)

I wasn't aware of these restrictions on variable redeclaration. I thought the full expression was parsed evaluated before any impact on the original. That would seem consistent (syntax).

;Local $sStr = "string"
;Local $sStr = $sStr & $sStr ; error

$sStr = "string"
$sStr = $sStr & $sStr ; assignment works alright here


Edit: Perhaps it's just simpler for things to be the way they are.

Edited by czardas
Posted

I revise what I said in post #8. This is less intuitive than I at first thought: self-referencing (previous post) is not the same as back-referencing (first post). The syntax simply looked as though it ought to do something, although I haven't used it myself. I can see it being useful in both cases, but I don't know how other languages deal with this kind of thing.

  • Moderators
Posted

Hi,

I have been racking my ageing brain trying to come up with a use case when such a "self-initialisation" functionality would be required - and signally failing to do so. The other thread participants appear to believe that the functionality should still exist, so could one of them please provide a sensible real-world example - rather than the "fun" scripts linked to in post #4 above.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

The code that was referenced earlier, my code, worked in v3.3.12.0 (just tested it a second a go). So seems to be a bug with the latest version.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

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
  • Recently Browsing   0 members

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