Skip to content

Instantly share code, notes, and snippets.

Nora Howard baroquebobcat

Block or report user

Report or block baroquebobcat

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
class A(object):
def __getattr__(s,i):
raise Exception('wth')
def raises(self):
def yep(self):
View better.mirah
macro def self.protected(methods_proxy:NodeList)
__straw_man__.expanded_children(methods_proxy).each do |c|
next unless c.kind_of? MethodDefinition
__straw_man__.add_modifiers_to(c, access: 'PROTECTED')
baroquebobcat /
Last active Aug 29, 2015

TODO List For 1.0

  • Finish closures
    • wrap new closure implementation so that this isn't an issue:
    • stabby lambdas
      • potato: add to parser w/ compiler error
    • non-local return
      • potato: just disallow return inside blocks converted into closures that aren't lambdas
    • nested bindings: they should work nicely
    • Java 8 MetaLambdaing when targeting 8. It'd be cool if we could use Java 8's lambda impl when on 8


Extensions are the way that Mirah adds methods to existing classes. When you call methods like each on collections, you are actually using extensions. They are helpful when you want to write DSLs and when you want to make a library you are using feel more Mirah-ish.

How do you use them?

Mirah comes with a number of built in extensions for Java's base types. For example, the methods each, map and empty are added to Collections. The built in extensions need no special invocation to be taken advantage of, they're already available. If you want to use extensions from a library, or optional extensions, you'll need to tell Mirah which ones you want to use.

The way you do that is by "using" the extension. using works just like import, but instead of making an imported class available, they extend other classes. For example, say you wanted to pluralize a string using an activesupport-like library. You could do it like so:

export NOTIFY_TIME=10
function timer_start {
if [ "$BASH_COMMAND" != "timer_stop" ]
View dynamical.rb
class Dynamical
define_method :works_fine do |&block|
5.times { |n| }
def self.defn name
define_method name do |&block|
5.times { |n| yield n }
View extensionmethods.mirah
package cool.extensions
extension StringExt[String]
def toInt
# or, less overloaded w/ generics

constants work by being translated into field accesses / assigns.

to ensure that constants that are seen before they are assigned can be resolved, the mirror typer keeps a hash of fields that it has seen, but haven't been assigned or declared yet.


Dreams of Mirah 1.0

What is Mirah?

Runtimeless JVM language that tries as hard as possible to feel like writing Ruby without cheating.

  • Should produce class files that are drop in replacements for Java.
  • Should interop well with Java and Java tools
  • It'd be nice if it interopped well with JRuby too, as well as other JVM langs, through compiler extensions.
  • It should have an extensible compiler

JVMLS Notes Day 1

Mirah NLR + yield

Thought I came up w/ talking w/ headius + kotlin dev

Have nonlocal return allowed only for blocks passed to fns that are either: macros, or take a specialized type that's generated from a yield

You can’t perform that action at this time.