npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ema-kotlin

v0.1.1

Published

EMA-Kotlin metadata package linking to the Kotlin implementation of Expressive and Modular Activation (EMA).

Readme

EMA-Kotlin

EMA-Kotlin is a Kotlin/JVM implementation of the Expressive and Modular Activation (EMA) mechanism for Context-Oriented Programming (COP). This implementation is inspired by and extends the ideas presented in the EMA paper and EMA-js reference implementation.

Status

  • Core runtime implemented in Kotlin (Signal, SignalComp, Layer, EMA, partial methods, proceed).
  • EMA-js behavior ported to Kotlin tests.
  • Public playground included under docs/ with multiple Kotlin examples.
  • GitHub Pages workflow included for automatic playground deployment.

Highlights

  • Signal-driven activation with declarative condition expressions.
  • Higher-order and recursive signal compositions.
  • Dynamic layer deployment / undeployment.
  • Partial method adaptation with Layer.proceed(...).
  • Layer enter/exit hooks and adaptation conflict scenarios.

Build & Test

./gradlew test --no-daemon

Current suite:

  • 82 tests
  • Includes Kotlin ports of EMA-js tests + additional coverage tests

NPM Package

Citation (APA)

Leger, P., Cardozo, N., & Masuhara, H. (2023). An expressive and modular layer activation mechanism for Context-Oriented Programming. Information and Software Technology, 156, 107132. https://doi.org/10.1016/j.infsof.2022.107132

Quick Start

import org.emakotlin.*

fun main() {
    EMA.init()

    val player = DynamicObject().apply {
        set("energy", Signal(0))
        defineMethod("speed") { 10 }
    }

    val turboLayer = LayerSpec(
        condition = SignalComp("e > 30")
    )

    EMA.exhibit(player, mapOf("e" to player.get<Signal>("energy")))
    EMA.addPartialMethod(turboLayer, player, "speed") {
        val base = Layer.proceed() as Int
        base + 7
    }

    println(player.call("speed")) // 10
    EMA.deploy(turboLayer)

    player.get<Signal>("energy").mutableValue = 40
    println(player.call("speed")) // 17
}

Core API

  • Signal(initialValue, id = "_")
  • SignalComp(expression, signals = emptyList(), id = "_")
  • LayerSpec(condition, enter, exit, name)
  • EMA.deploy(layerSpec) / EMA.undeploy(layerSpec)
  • EMA.exhibit(target, mapOf("id" to signal))
  • EMA.addPartialMethod(layerSpec, targetObj|listOfObjs, methodName) { ... }
  • Layer.proceed(vararg args)

Playground

Playground examples included:

  1. Signal composition
  2. Enter/exit transitions
  3. Partial method + proceed
  4. Recursive context state

Project Structure

  • src/main/kotlin/org/emakotlin/: EMA-Kotlin runtime
  • src/test/kotlin/org/emakotlin/: translated EMA-js tests + extra tests
  • docs/: playground and examples for GitHub Pages

Compatibility Notes

  • Designed for Kotlin/JVM.
  • Uses Gradle wrapper and JDK 21 toolchain defaults in gradle.properties.

Related

License

MIT (see LICENSE).