Analysis of Windows Active Directory environment using BloodHound

BloodHound is a tool for clarifying unintended relationships in the Active Directory environment based on graph theory. This allows you Domain Admins to discover paths for migrating to other users or…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Macro Rules

Metaprogramming Elixir — by Chris McCord (10 / 48)

👈 The World Is Your Playground | TOC | The Abstract Syntax Tree — Demystified 👉

Before we write more complex macros, we need to review a couple of rules to temper our expectations. Macros give us awesome power, but with great power comes great responsibility.

You may hear this rule touted loudly when talking with others about metaprogramming. Often it’s unfounded, but before we get too carried away, we have to remember that writing code to produce code requires special care. It’s easy to get caught in our own web of code generation, and many have been bitten by reckless complexity. When taken too far, macros can make programs difficult to debug and reason about. There should always be a clear advantage when we attack problems with metaprogramming. In many cases, standard function definitions are a superior choice if code generation is not required.

Metaprogramming is sometimes framed as complex and fragile. Together, we’ll dispel these myths by producing robust, clear programs that offer productive advantages in a fraction of the required code. It’s important to avoid letting the potential for abuse scare you away from fully exploring Elixir’s macro system. The best way to learn metaprogramming is to throw away your preconceived notions and explore with a curious and open mind. You can’t be afraid to be a little irresponsible while you’re learning.

It’s important to keep this duality in mind when writing macros. Along our metaprogramming journey, you’ll see how to apply your sharp skills responsibly and look at common pitfalls to avoid. Great code speaks for itself, and we’ll be writing plenty of it.

👈 The World Is Your Playground | TOC | The Abstract Syntax Tree — Demystified 👉

Add a comment

Related posts:

Building a World

Brace yourself for a fun challenge: build a photorealistic 3D renderer from scratch! It's easier than you think. In just a couple of weeks, build a ray-tracer that renders beautiful scenes with shadows, reflections, brilliant refraction effects, and subjects composed of various graphics primitives: spheres, cubes, cylinders, tri

Day Sleeper

My coffee lies in front of me, cold and untouched I’ll go back, it’s there when I hang my head I take a belt to help migraines from the onset He winced at the sting lingering in my jargon…

Carta Aberta

Recomendaram-me que lhe escrevesse, aproveitei que hoje acordei pensando em você. Me demorei no sono, me demorei no leito, me demorei em escrever-lhe. Não é novidade que periodicamente seu semblante…