Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 891013
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:49:28+00:00 2026-05-15T13:49:28+00:00

original (update follows) I’m working with a lot of anonymous functions, ie functions declared

  • 0

original (update follows)

I’m working with a lot of anonymous functions, ie functions declared as part of a dictionary, aka "methods". It’s getting pretty painful to debug, because I can’t tell what function the errors are happening in.

Vim’s backtraces look like this:

Error detected while processing function NamedFunction..2111..2105:
line    1:
E730: using List as a String

This trace shows that the error occurred in the third level down the stack, on the first line of anonymous function #2105. IE NamedFunction called anonymous function #2111, which called anonymous function #2105. NamedFunction is one declared through the normal function NamedFunction() ... endfunction syntax; the others were declared using code like function dict.func() ... endfunction.

So obviously I’d like to find out which function has number 2105.

Assuming that it’s still in scope, it’s possible to find out what Dictionary entry references it by dumping all of the dictionary variables that might contain that reference. This is sort of awkward and it’s difficult to be systematic about it, though I guess I could code up a function to search through all of the loaded dictionaries for a reference to that function, watching out for circular references. Although to be really thorough, it would have to search not only script-local and global dictionaries, but buffer-local dictionaries as well; is there a way to access another buffer’s local variables?

Anyway I’m wondering if it’s possible to dump the source code for the anonymous function instead. This would be a lot easier and probably more reliable.

update

I ended up asking about this a while back on the vim_use mailing list. Bram Moolenar, aka vim’s BDFL, responded by saying that "You are not supposed to use the function number." However, a suitable alternative for this functionality has not been suggested, as of early September 2010. It’s also not been explicitly mentioned whether or not this functionality will continue to work in subsequent vim releases. I’ve not tried to do this (or anything else, for that matter) in the recently released vim 7.3.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T13:49:28+00:00Added an answer on May 15, 2026 at 1:49 pm

    The :function command tries to stop you from specifying the numbered functions (their name is just a number) but you can trick it using the {...} dynamic function name feature, throw in some :verbose and you have a winner:

    :verbose function {43}
      function 43()
          Last set from /home/peter/test.vim
    1   throw "I am an exception"
      endfunction
    

    This was not at all obvious in the help docs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

UPDATE: I should have mentioned in the original post that I want to learn
Update 7/17 SOLVED I've updated my code to the Solved version. Original Question I'm
UPDATE: This question is out of date, but left for informational purposes. Original Question
I am finding my SQL Server database fields getting hacked as follows. Please note
Update : I solved the decoding problem, thanks to pimvdb Follows the solution (in
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
Original question: Note: Below plugin pattern based on the official jQuery docs . I'm
original string is a,d,k I want to remove all , and make it to
ORIGINAL Q: I'm wondering if anyone has had experience of migrating a large Cobol/PL1
original column is like: 0.45::rafas::4.0::0.0::0.9 0.35::rasaf::4.0::110.0::1.0 and i would like to break the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.