metaprogramming


Can function application be overriden with Macro in Elixir?


Let's say I'd want to override each function call with a macro that counts how many times I called each particular function.
Is it possible in Elixir?
I know there is a possibility of overriding builtin macros and functions with
import Kernel, except: [name: arity]
import MyOwnKernel
But it doesn't seem to work for apply/2 nor apply/3
You cannot. Those are defined as special forms (Kernel.SpecialForms) and they cannot be overridden.
Not the answer to your direct question, but if you really want to trace function calls and do some analysis, you may consider Erlang tracing capabilities. I provided a simple example in this answer.
Also, you might look into fprof for profiling, which can give you function count. IIRC fprof analyzes only the process in which you start it, and you can't run multiple profiles simultaneously.

Related Links

Julia: create specific index variables in Base.Cartesian
How to define a function based on a previously defined function on a module?
Io's method scope
How to instantiate a class using an explicit first, and a default second argument, via the meta model?
access to member of object in php with value of parameter? [closed]
How to construct a macro emitting arbitrary number of possible matches?
Generate algebraic expression at compile time in D
Is D powerful enough for these features?
Embedding a domain specific language in an OCaml toplevel — to Camlp4 or not?
Is it possible to do code generation in Coffeescript?
In Pharo, my classes should not appear in the Browser, or even in the Smalltalk global
Why does the halting problem make it impossible for software to determine the time complexity of an algorithm
Pharo: #subclass:instanceVariables… message personalized
How can I write metrics into my software that speak to investors while standing up to geek scrutiny? [closed]
CoffeeScript dynamic methods
Tool for automated porting and language that can compile into others

Categories

HOME
codenvy
jsf-2.2
vscode-extensions
xbee
bookmarks
jtextpane
recordrtc
little-proxy
spring-social
endpoint
job-scheduling
mvc-mini-profiler
feathersjs
sigma.js
oledb
cgbitmapcontext
dataflow-diagram
qliksense
zxing
xcode-ui-testing
surveymonkey
slidetoggle
motion-detection
angularjs-components
bioinformatics
mql
custom-controls
record
dynamic-jasper
arduino-ide
hivemq
node-mssql
opensmpp
dcmtk
wmp
angular-http
httr
plan-9
textsum
ntvs
reportservice2010
singleinstance
stdmap
tinkerpop
boxing
libjpeg
rspec2
simevents
android-wake-lock
stream-processing
spreadjs
hadoop-partitioning
blitline
piracy-prevention
jbase
computer-architecture
jdi
intel-c++
cgi-bin
iced-coffeescript
typemock
branch-and-bound
apache-commons-daemon
ansi
adehabitathr
apache-spark-1.3
dbaccess
crowd
webfinger
rickshaw
tweenlite
cuba
ios8-extension
vsx
file-not-found
gae-quotas
ecslidingviewcontroller
openargs
script#
node-blade
resource-management
panda3d
paginator
garbage
thttpd
jsr286
relative
expression-blend-4
winmain
xui
objective-j
addchild
zen
pos-for-.net
feasibility

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App