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
5
votes
2 answers

Programming strategies for allowing anonymous / unauthenticated voting on web sites

I'd like some pseudo-code or white board suggestions for permitting unauthenticated voting on my site. I've looked through related threads on this topic, but I think my scenario is different enough to warrant its own thread. There are 3 core…
Armchair Bronco
  • 2,367
  • 4
  • 31
  • 44
5
votes
5 answers

Serializing anonymous types

I'd like to convert anonymous type variable to byte[], how can I do that? What I tried: byte[] result; var my = new { Test = "a1", Value = 0 }; BinaryFormatter bf = new BinaryFormatter(); using (MemoryStream ms = new MemoryStream()) { …
user3018896
  • 99
  • 1
  • 1
  • 7
5
votes
1 answer

c++ anonymous constructor doing weird things

This sample program shows how a different constructor will be called depending on whether you pass in a local variable, a global variable, or an anonymous variable. What is going on here? std::string globalStr; class aClass{ public: …
Eric Fitting
  • 160
  • 1
  • 7
5
votes
5 answers

Is it possible to instantiate abstract class using anonymous inner class and mechanism to access method within it

There is no any way to create object using abstract class. But when using anonymous inner class it is possible to run the following code. And not only that start() method is not accessible, therefore What is the reason for running following program…
Saveendra Ekanayake
  • 3,153
  • 6
  • 34
  • 44
5
votes
2 answers

Removing anonymous listener

When trying to adopt the style of implementing a listener using anonymous or nested class in order to hide the notification methods for other uses than listening (i.e. I don't want anybody to be able to call actionPerformed). For example from java…
skyking
  • 13,817
  • 1
  • 35
  • 57
5
votes
3 answers

Working with anonymous modules in Ruby

Suppose I make a module as follows: m = Module.new do class C end end Three questions: Other than a reference to m, is there a way I can access C and other things inside m? Can I give a name to the anonymous module after I've created it (just…
Byron Park
  • 51
  • 1
  • 2
5
votes
0 answers

Facebook Graph API access with client token/anonymous?

I'm working on an iOS app where the users need to be able to access the Facebook Graph API without having a Facebook login (because they signed up for my app as email-only). They mainly need to retrieve other Facebook users' public feeds…
Zack Morris
  • 4,727
  • 2
  • 55
  • 83
5
votes
1 answer

Operating System - Anonymous Memory

In terms of operating system I have seen a few times the term anonymous memory, but I don't really know, what that is. If someone asks me something about it I couldn't really say something with great certainty what that is. I also searched for an…
user2965601
5
votes
1 answer

Objective-C. Multiple anonymous categories?

About anonymous categories: But can't I declare an anonymous category for the second time to split my variables' and methods' definitions? I know that Xcode allows to do so, but will it work without problems? UPDATED I explain againg. The main…
5
votes
2 answers

Can I use an aggregate initializer to return a struct in C++?

I have a function returning a named struct consisting of two ints, as follows: struct myStruct {int i; int j;}; myStruct myFunction(int myArg){ switch (myArg) { case 0: return {1,2}; case 1: return {2,3}; default: return {4,5}; …
StephenD
  • 231
  • 1
  • 10
5
votes
2 answers

passing a variable to an anonymous function in a wordpress filter

I am trying to override a plugin that creates SEO titles in wordpress. The filter does the job but I need to dynamically create the titles. So I create the title then pass it to an anonymous function. I could have another function that creates the…
jhodgson4
  • 1,566
  • 3
  • 20
  • 35
5
votes
2 answers

Cannot wrap my head around Immediately Invoking Anonymous Functions in Javascript

I have been studying framework development for a few weeks, and I ran across what is highly suggested and pressured in the world of lib development, Immediately-invoking Anonymous Functions. I never can get it to work, and I have failed to find a…
ModernDesigner
  • 7,539
  • 10
  • 34
  • 41
5
votes
1 answer

Method on a struct field of type defined by a type literal

When decoding JSON I've always explicitly written a struct for each object so that I could implement the Stringer interface for individual objects in a parent struct like so: type Data struct { Records []Record } type Record struct { ID…
BeMasher
  • 279
  • 3
  • 12
5
votes
5 answers

Return datatype of a linq query

I have a function that returns an object that represents a record in my database plus additional columns. Instead of creating a separate class for this object I was wondering if there is another way, for example: public object GetRecord(string…
Arcadian
  • 4,312
  • 12
  • 64
  • 107
5
votes
2 answers

Inner classes not being included in jar file

I hava made a runnable jar file out of six classes: Main: Contains the main method, and specified in the manifest (I included a new line) Main$1 and Main$2: 2 anonymous inner classes that are in the main class. (Main$2 is in the main method, but I…
user1605892
  • 127
  • 2
  • 8