Questions tagged [mop]

A meta-object protocol (MOP) is an interpreter of the semantics of a program that is open and extensible.

MOP stand for meta-object protocol.

A MOP determines what a program means and what its behavior is. It is extensible in that a programmer (or meta-programmer) can alter program behavior by extending parts of the MOP.

The MOP exposes some or all internal structure of the interpreter to the programmer.

The MOP may manifest as a set of classes and methods that allow a program to inspect the state of the supporting system and alter its behavior.

MOP's are implemented as object-oriented programs where all objects are meta-objects.

48 questions
5
votes
1 answer

Add a missing property in a groovy @Canonical bean constructor call?

I am new to groovy and just started exploring its metaprogramming capabilities. I got stuck with adding missing properties on a bean constructor call. In a class to be used with FactoryBuilderSupport, I want to dynamically add those properties that…
Ulrich Schuster
  • 1,670
  • 15
  • 24
5
votes
1 answer

Class finalization: how to avoid creating dummy instances?

I've run into a problem that a third-party library needs to act on a class as if it was finalized. After some reading I understand the motivation behind this mechanism, but I don't really know how it functions. Example: (make-instance 'expression…
user797257
5
votes
1 answer

Problem with mixins in a MooseX::NonMoose class

Consider the following: package MyApp::CGI; use Moose; use MooseX::NonMoose; use Data::Dumper; extends 'CGI::Application'; BEGIN { print "begin isa = " . Dumper \@MyApp::CGI::ISA; }; print "runtime isa = " . Dumper \@MyApp::CGI::ISA; ...…
friedo
  • 65,762
  • 16
  • 114
  • 184
4
votes
2 answers

How to make the instances of a class using a metaclass inherit from a specific superclass

I'm trying to implement json serialization API for common lisp. To achieve this I've defined a metaclass called json-class. This metaclass defines the slot options :ignore which are used to ignore specific slots of the object. Since I'm using yason…
MPaga
  • 319
  • 2
  • 6
4
votes
1 answer

Common Lisp: extract methods from generic function

Is there a way to extract a list of methods from a generic function in Common Lisp? For example: (defmethod say ((self string)) ; method-0 (format t "Got string: ~a~%" self)) (defmethod say ((self integer)) ; method-1 (format t "Got integer:…
AlexDarkVoid
  • 485
  • 3
  • 12
4
votes
1 answer

Is there a way to gather slot-definition-readers from all the inheritance tree?

The generic function slot-definition-readers gets an argument that must be a direct-slot-definition. If an object is an instance of a class that inherits from another class how can I get hold of the readers of all the effective-slots of the object?…
Paralife
  • 6,116
  • 8
  • 38
  • 64
3
votes
0 answers

How does project.getProperty() work in Gradle?

Gradle API doesn't have this method, but there's no compile error, and it does get the property at runtime. https://docs.gradle.org/current/javadoc/org/gradle/api/Project.html I tried using a debugger to discover what happened behind the scene, the…
ssgao
  • 5,151
  • 6
  • 36
  • 52
3
votes
1 answer

unbound slot when obtaining class precedence list?

Why can't I obtain a simple class-precedence-list in sbcl? * (sb-mop::class-precedence-list (find-class 'cons));;works (# # # #) * (defclass my-class ()…
ealfonso
  • 6,622
  • 5
  • 39
  • 67
3
votes
1 answer

Confused about the invokeMethod method in the Groovy MOP

First look at the following Groovy code: class Car { def check() { System.out.println "check called..." } def start() { System.out.println "start called..." } } Car.metaClass.invokeMethod = { String name, args -> …
Samuel Gong
  • 157
  • 1
  • 1
  • 7
3
votes
1 answer

Anonymous methods in common lisp

I want to save a generic function as a variable: (defvar *gf* (make-instance 'standard-generic-function) But when adding a method I have to define call-next-method and next-method-p myself: (add-method *gf* (make-instane…
cl-porky11
  • 339
  • 1
  • 11
3
votes
1 answer

sbcl / CLOS Why do I have to add a "validate-superclass"-Method here?

In SBCL, when I define new metaclass CL-USER> (defclass counting-class (standard-class) ((counter :initform 0))) # and add a method to the GF "make-instance": CL-USER> (defmethod make-instance :after ((class…
Patrick
  • 508
  • 2
  • 9
3
votes
2 answers

Treating a java array of more than two dimensions as a list

I am using Groovy to write a DSL handling BASIC and I would like some assistance with how to handle multi (more than 2) dimensional arrays. I am dealing with BASIC code like this: 100 LET X = A(1, 2, 3) It is easy to handle the 1 dimensional case -…
adrianmcmenamin
  • 1,081
  • 1
  • 15
  • 44
2
votes
1 answer

How to access metaobjects/slot-definition slots? Why slot-value can access slots of objects but not slots of metaobjects?

I'm having a problem acessing slots out of slot definitions. I can inspect class objects, see their slots definitions and even get some standard info about the slots definitions. However I can't access user-defined information about the slot…
2
votes
2 answers

Is this a good alternative to Moose Perl?

I have been a searching for alternative to Moose (Modern object-oriented Perl) Because Moose is slow I have seen several post relation to this issue, I not want that. Example from the same creator:…
Imylor
  • 384
  • 1
  • 9
2
votes
1 answer

What is the static version of propertyMissing method in Groovy?

ok - tried looking /reading and not sure i have an answer to this. I have a Utility class which wraps a static ConcurrentLinkedQueue internally. The utility class itself adds some static methods - i dont expect to call new to create an instance of…
WILLIAM WOODMAN
  • 1,185
  • 5
  • 19
  • 36