Modify

Opened 5 years ago

Last modified 3 years ago

#2833 new Feature Request

macro @funcname

Reported by: anonymous Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

Please add a macro, variable or something else that will contain the name of the current function.
This is useful for debugging

Func Test($param, $from_line = @ScriptLineNumber)
	ConsoleWrite('Executing function: ' @funcname & ' calling from ' & $from_line & ' line' & @CRLF)

EndFunc

Attachments (0)

Change History (7)

comment:1 Changed 5 years ago by mLipok

Some time ago I made to this functionality, my own solution.
Maybe from here also shows a large number of issue found by me, I just have a good additional diagnostic tools of my own scripts.

But the native solution sounds promising.

comment:2 Changed 5 years ago by Jpm

  • Type changed from Bug to Feature Request

comment:3 Changed 5 years ago by TicketCleanup

  • Version 3.3.12.0 deleted

Automatic ticket cleanup.

comment:4 Changed 5 years ago by BrewManNH

There is a tool in the Tools menu in Scite, if you've installed the full version of SciTE4AutoIt3, that allows you to add a function trace line to every function, you might be able to modify that to create a variable instead of the ConsoleWrite line that it does now.

comment:5 Changed 3 years ago by Zinthose

I'm surprised this hasn't been added yet.

I'm working on some pretty insane deep nested functions and was trying to do something like This:

If IsString($Variable) And IsDeclared($Variable) Then
  Return Execute(@FuncName & "($" & $Variable & ")")
EndIf

This is to address an issue when resolving a variable name using Eval from a global array. The problem is any changes are saved to the local copy made with Eval and not the original variable from the global scope.

I guess ideally I'd like to see Eval have a ByRef parameter to address my issue but I'd still like to see @FuncName implemented.

comment:6 Changed 3 years ago by jchd18

If this is ever considered for actual implementation I believe that a macro @CallStack would be even more useful, returning an array of functions called in decreasing depth order (LIFO mode).
If the associated overhead is going to block making that real, perhaps it's time to have an Opt() switching that on for those who need it.

comment:7 Changed 3 years ago by BrewManNH

Zinthose, I think you misunderstood the request or you're trying to implement it in the worst way possible.
What the request is asking for is to have a macro that tells you the currently executing function, which I don't think would be at all useful because it's just as easy to include a variable set to the name of the function to do exactly the same thing, but would require a coder to have to think for themselves.
Your request is trying to rerun the current function. I'm not sure of what you think you're attempting, but I don't see that as a smart way to do it.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.