Skip to content

Instantly share code, notes, and snippets.

@Devan-Kerman
Last active July 9, 2021 21:46
Show Gist options
  • Save Devan-Kerman/89409a50bfceb7d5005c379f4cd17263 to your computer and use it in GitHub Desktop.
Save Devan-Kerman/89409a50bfceb7d5005c379f4cd17263 to your computer and use it in GitHub Desktop.

A terrible language that could pass as a real thing if you gave it to a webdev.

Values functions (func param1) objects (package, class, int, etc.)

Variable Declaration
There is no explicit variable declaration, nor type safety

hello = 5

Exceptions
There are none.

// package is a type too
// file name as variable, imports are a redundant feature, less redundancy = less to learn

// conceptually, `java` is interpretted as a `package` object, then the property `lang` is retrieved from it, which on packages, just creates a new package with the name `<current>/<methodinvocationanem>`, or if a class is present, returns a file name

System = java lang System

// prints 'null'
System out println(helo)
// like lua, typos = get fucked

Operators
Having operators as a seperate concept means making the language harder to learn, so now they're infix functions. Less features = Less time wasted learning.

() is optional, except for functions with no parameters

System out println a add(a)
// instance functions are infix too
System out println a foo()
System out println a foo param
// prints null
System out println a methodThatDoesntExist()

Scope and Control Flow
There are no brackets, it's all indentation based

a = Random randInt(5)
if a
  System out println(a)
else
  System out println("a == 0")

while a
   // no --, less features = lower learning curve
   a = a sub(1)

Functions
There is no return keyword, it's not even an option. Less Options = More consistency = More readability

functionName = func param1 param2 param3
  param1 add(param2 add(param3))

// because of order of operations, this works
println = System out println

Classes
There is no static.
There are no access flags, no final/private/public etc.
All invocations and field accesses are dynamic.\

OuterClassName.ja

constant = 4

notReallyStaticFunction = func a
  System out print a
  
class InnerClassName SuperType InterfaceTypeA InterfaceTypeB
  field = 3
  func <init>
  
  <init> = func _field
    field = _field
    
  foo = func field
    System out println this field
    System out println this field

SomeOtherName.ja

// creates a new FileName, invokes notReallyStaticFunction on it with 5 as the parameter. I told you there is no static!
FileName notReallyStaticFunction 5
// creates a new FileName, and gets `constant`. Again, no statics!
FileName constant

test = FileName InnerClassName 5
test foo 4
// failed constructors return null
test = FileName InnerClassName 4 5
test = FileName

Order of Operations
0) parenthesis

  1. variable in order of localest to globalest scope. (local, class, global)
  2. null

Advanced Features

var-args

foo = func name, params...
  for param params
    java lang System println param

array tuples

tuple = 5, 6

// prints 6
println tuple 2

mymethod tuple
// or (this isn't a syntax feature, it's just how parantheses already work)
mymethod (5, 6)

// tuples can be split
a, b = mymethod 4

The package object needs to intercept all incoming method calls, this can be done like this

Package.ja

parent
name

<init> = func _name, _parent
  name = _name
  parent = _parent

toString = func
  if parent // if parent != null
    parent toString add "." add name
  else
    name

<property> = func name, params...
  fun = super <property> name // invokes the <property> method, which ironically is itself a property
  clsldr = getClass getClassLoader
  clsname = toString() add "." add name
  cls = Classes forName clsldr clsname
  if cls
    cls
  else
    Package name this

if you wanted to intercept an object's property resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment