Simple user-defined meta-level to manipulate types of instances as object.

Unfortunately, since the meta-objects are user-defined they are provided without any pre-defined information or behavior. For the same reasons, the Nit OO mechanisms do not rely on this user-defined meta-level.

However meta permits the definition of user-defined meta-classes at any level of meta, even with user-defined meta-loops.

Meta-classes

Meta-classes can be defined easily in 3 steps:

  • define a root for the class hierarchy (eg XObject)
  • define a meta-class (eq XClass[E: XObject] super Class[E])
  • redefine CLASS and class_factory in the root
class XObject
   redef CLASS: XClass[SELF]
   redef class_factory(name) do return new XClass[SELF](name)
end
class XClass[E: XObject] super Class[E] end

var x1 = new XObject
var x2 = new XObject
assert x1.get_class == x2.get_class
assert x1.get_class isa XClass[XObject]
assert x1.get_class.get_class isa Class[XClass[XObject]]

Limitation

Currently works only with the interpreter nit and the compiler with --erasure (without --rta).

--rta will try to detect all the runtime types, and will infinitely discover Class[Class[Class[....]]]. Unfortunately, --separate and --global require --rta.

Moreover, the interpreter and --erasure have a different behavior with generics since with --erasure a single meta-instance is shared for all type variations of a same generic class.

Class names are used as a primary key to identify classes. But name conflicts are not managed and will make the program crashes at runtime (on some cast error)

All groups and modules

module meta

meta :: meta

Simple user-defined meta-level to manipulate types of instances as object.
package_diagram meta meta core core meta->core serialization serialization serialization->meta serialization... ... serialization...->serialization

Parents

package core

core

Nit common library of core classes and methods

Children

package serialization

serialization

Abstract serialization services

Descendants

package a_star

a_star

A* pathfinding in graphs
package android

android

Android platform support and APIs
package app

app

app.nit, a framework for portable applications
package array_debug

array_debug

Exposes functions to help profile or debug Arrays.
package bucketed_game

bucketed_game

Game framework with an emphasis on efficient event coordination
package counter

counter

Simple numerical statistical analysis and presentation
package curl

curl

Data transfer powered by the native curl library
package dom

dom

Easy XML DOM parser
package egl

egl

Interface between rendering APIs (OpenGL, OpenGL ES, etc.) and the native windowing system.
package fca

fca

Formal Concept Analysis
package gamnit

gamnit

Portable game and multimedia framework for Nit
package geometry

geometry

Basic geometry data structures and services.
package github

github

Nit wrapper for Github API
package glesv2

glesv2

OpenGL graphics rendering library for embedded systems, version 2.0
package ios

ios

iOS support for app.nit
package json

json

read and write JSON formatted text
package linux

linux

Implementation of app.nit for the Linux platform
package markdown2

markdown2

package mongodb

mongodb

MongoDB Nit Driver.
package more_collections

more_collections

Highly specific, but useful, collections-related classes.
package mpi

mpi

Implementation of the Message Passing Interface protocol by wrapping OpenMPI
package msgpack

msgpack

MessagePack, an efficient binary serialization format
package neo4j

neo4j

Neo4j connector through its JSON REST API using curl.
package nitcc_runtime

nitcc_runtime

Runtime library required by parsers and lexers generated by nitcc
package nitcorn

nitcorn

Lightweight framework for Web applications development
package nlp

nlp

Nit wrapper for Stanford CoreNLP
package noise

noise

Noise generators PerlinNoise and InterpolatedNoise
package parser_base

parser_base

Simple base for hand-made parsers of all kinds
package popcorn

popcorn

Popcorn
package poset

poset

Pre order sets and partial order set (ie hierarchies)
package sexp

sexp

S-Expression parsing facilities
package text_stat

text_stat

Injects stat-calculating functionalities to Text and its variants
package vsm

vsm

Vector Space Model