Questions tagged [anonymous]

DO NOT USE! Please use a more specific tag such as [anonymous-function] or [anonymous-class].

The term anonymous has come to represent different aspects of development with the rise of the functional programming style and the use of anonymous on-demand applications.

In an effort to disambiguate this tag, it has been split into the following subcategories:

Category Description
Anonymous Classes An anonymous class is a local class without a name. An anonymous class is defined and instantiated in a single succinct expression using the new operator.
Anonymous Functions Anonymous functions use a block of code as a value, defining it as an inline function without a name.
Anonymous Methods An anonymous method is a procedure or function that does not have a name associated with it.
Anonymous Types Anonymous types are data types which dynamically add a set of properties into a single object without having to first explicitly define a type
Anonymous Users Anonymous users are individuals or systems that make use of a product or service, without formally registering account details and are instead associated with some token or identifier.

Former Tag Definition

For new questions, see [anonymous-class] and [anonymous-function].

Typically, a programming language construct like a function or class has a name associated with it -- a symbol that can be used to refer to the construct in some context. An anonymous function or class is one that, in contrast to normal practice, has no name. For example, in Java, you can create an anonymous class using a special syntax that defines a class and constructs an instance of it at the same time:

Runnable r = new Runnable() {
    public void run() {
        System.out.println("Running");
    }
};

The variable r holds a reference to an instance of a class which has no name in Java, but which implements the Runnable interface and can be used anywhere a Runnable instance is needed.

702 questions
13
votes
1 answer

Why is anonymous class required in "super type token" pattern in java

In Neal Gafter's "super type token" pattern (http://gafter.blogspot.com/2006/12/super-type-tokens.html), an anonymous object was used to pass in the parameterized type : class ReferenceType{} /* anonymous subclass of "ReferenceType"…
superluli
  • 133
  • 9
13
votes
2 answers

Reference to Public Enum results in Anonymous Class

I'm getting an anonymous class at compile-time that I'm not expecting. Relevant code follows, then a more detailed explanation: Entirety of CircuitType.java: public enum CircuitType { V110A20, V110A30, V208A20, V208A30 } From Auditor.java, lines…
Maarx
  • 633
  • 1
  • 7
  • 18
12
votes
2 answers

c# Anonymous Interface Implementation

i've already seen this question a few times but i still don't get it. In Java, i can do this: new Thread(new Runnable(){ @Override public void run() { System.out.println("Hello"); } }).start(); In my opinion, this is a very nice way to…
Sn0bli
  • 241
  • 1
  • 2
  • 7
12
votes
2 answers

Javascript : Anonymous function, access to global variables

After hours of search, I Have a problem with my code Below. In fact, I'm not very far from answer I think but I'm still blocked… I have an anonymous function called inside a loop and I want to access and refresh global variables but I tried with…
Viot Camille
  • 197
  • 1
  • 1
  • 10
12
votes
6 answers

java sort using anonymous class

I have class in which I am sorting a list. import java.util.*; public class First { private static HashMap msgs; public static void main(String[] args) { List ls=new ArrayList(); …
Osman Khalid
  • 778
  • 1
  • 7
  • 22
11
votes
2 answers

How to get firebug profiler to show functions as non-anonymous

On a Mac, Firebug outputs proper function names in profiler mode. On a PC, allmost all functions are logged as 'anonymous'. In this instance, almost all the function calls are prototype methods. Is there a way to get at the function names on the PC…
FlavorScape
  • 13,301
  • 12
  • 75
  • 117
11
votes
4 answers

java anonymous classes and synchronization and "this"

I am dealing with a race condition, I believe, in my JAVA GUI. I have some methods that create an "anonymous method" inside an anonymous class like this: synchronized foo() { someMethod(new TimerTask() { public synchronized…
jbu
  • 15,831
  • 29
  • 82
  • 105
11
votes
3 answers

Best way to send anonymous email like craigslist

Craigslist has a nice feature where when you respond to a poster you respond to an email such as job-fepsd-1120347193@craigslist.org. The email is then in turn directed to the real email. I am looking for a couple pointers on how to do this with…
Levi
  • 12,214
  • 14
  • 43
  • 47
11
votes
7 answers

Global const string& smells bad to me, is it truly safe?

I'm reviewing a collegue's code, and I see he has several constants defined in the global scope as: const string& SomeConstant = "This is some constant text"; Personally, this smells bad to me because the reference is referring to what I'm assuming…
James Michael Hare
  • 37,767
  • 9
  • 73
  • 83
10
votes
1 answer

Why doesn't GCC show any errors on an anonymous variable?

I read this question that explains how anonymous variables are invalid in C++. But the following program compiles without any warning or errors on GCC 7.2 (even with -Wall) - demo: int main() { int (*); // anonymous variable? } Here, this is…
Jayesh
  • 4,755
  • 9
  • 32
  • 62
10
votes
4 answers

Entity framework `AsNoTracking` is not working with anonymous projection

In the below snipped i try to fetch data using Anonymous Projection and i would like do not track the entities that is fetched. Note : i have already gone through existing stack question,yet unable to find a working solution for me using (var db =…
Eldho
  • 7,795
  • 5
  • 40
  • 77
10
votes
2 answers

UILabel (CALayer) is using large amounts of virtual memory

In Xcode and Instruments I see UILabel (CALayer) using large amounts of virtual memory (Anonymous VM). I see about 235 KB of virtual memory per UILabel. I think this perhaps is a new issue with iOS 7.1 or 7.1.1. Is this expected? I created a simple…
pmoosman
  • 101
  • 1
  • 3
10
votes
1 answer

Disable anonymous user cookie with Django

I use django auth for my website, which needs to have the session middleware installed. Django session middleware always adds a session cookie, even for anonymous users (users that are not authenticated). When they authenticate the cookie is…
kollo
  • 1,285
  • 3
  • 20
  • 33
9
votes
4 answers

What's the use for anonymous functions in AS3?

I came across them, but I have yet to see why I should use them. Could someone explain it?
MKII
  • 892
  • 11
  • 36
9
votes
4 answers

Overriding a portion of a google.com anonymous function

If a javascript function is declared anonymously is there any way to override it or portions of it? I am attempting to stop google.com's instant search from hijacking the up and down arrow keys to move through your search rankings. I have identified…
mrtsherman
  • 39,342
  • 23
  • 87
  • 111
1 2
3
46 47