Objeck logo

Objeck Randy Hollines

Use this command to install Objeck:
winget install --id=RandyHollines.Objeck -e

Objeck is a 64-bit object-oriented and functional programming language designed to be fast, intuitive, and lightweight.

Objeck is a 64-bit object-oriented and functional programming language designed to be fast, intuitive, and lightweight. It supports cross-platform development for Linux, macOS, and Windows, including Docker and Raspberry Pi environments.

Key Features:

  • Cross-platform support for Linux, macOS, and Windows
  • JIT-compiled runtimes for ARM64 and AMD64 architectures
  • REPL shell for interactive programming
  • LSP plugins for popular IDEs like VS Code, Sublime Text, and Kate
  • Extensive libraries for machine learning, web development, data exchange, encryption, and more
  • Type inference and reflection capabilities

Audience & Benefit: Ideal for developers seeking a flexible and lightweight language for object-oriented or functional programming across multiple platforms. Objeck’s intuitive design, portability, and robust API support enable efficient development of scalable applications while maintaining clean and maintainable code.

Objeck can be installed via winget.

README

Another programming language

Updates

  • v2025.6.2

  • v2025.3.0

    • Updated VS Code LSP support for macOS and Linux ✍🏽
    • Collection bug fixes 🫙
    • LSP bug fixes ⌨️
    • More aggressive method inlining 🏎️
  • v2025.2.2

    • Improved named pipe support 🔌
    • Updates to the LSP client/server ⌨️
    • Fixed Windows installer issues with missing DLLs 🏗️
    • Error handling bug fixes

Code Examples

# hello world
class Hello {
  function : Main(args : String[]) ~ Nil {
    "Hello World" → PrintLine();
    "Καλημέρα κόσμε" → PrintLine();
    "こんにちは 世界" → PrintLine();
  }
}
# openai response
query := Collection.Pair->New("user", "What is the most common espresso drink ordered in Columbia?");
response := Response->Respond("gpt-4o-mini", query, token);
if(response = Nil) {
  Response->GetLastError()->ErrorLine();
  return;
};
response->ToString()->PrintLine();
# gemini generate w/ schema
content := Content->New("user")->AddPart(TextPart->New("What are the top 5 cities average snowfall in the Eastern US by city for the past 5 years?"));

# set schema
schema_def := ParameterType->New(["year", "name", "inches"], true);
schema_def->AddProp("year", ParameterType->New(ParameterType->Type->STRING));
schema_def->AddProp("name", ParameterType->New(ParameterType->Type->STRING));
schema_def->AddProp("inches", ParameterType->New(ParameterType->Type->INTEGER));      
resp_schema := Pair->New("application/json", schema_def);

# make query
candidates := Model->GenerateContent("models/gemini-2.5-flash-preview-05-20", content, resp_schema, EndPoint->GetApiKey());
if(candidates <> Nil & <>candidates->IsEmpty()) {
  Data.JSON.JsonElement->Decode(candidates->First()->GetAllText()->Trim())->PrintLine();
};
# openai image identification 
bytes := System.IO.Filesystem.FileReader->ReadBinaryFile("../gemini/thirteen.png");
bytes->Size()->PrintLine();

image := API.OpenAI.ImageQuery->New("What number is this?", bytes, API.OpenAI.ImageQuery->MimeType->PNG);
file_query := Collection.Pair->New("user", image);

response := Response->Respond("gpt-4o-mini", file_query, token);
if(response = Nil) {
  Response->GetLastError()->ErrorLine();
  return;
};

Data.JSON.JsonElement->Decode(response->GetText())->PrintLine();

Design [1]

  • Object-oriented and functional
  • Cross-platform support for Linux, macOS, and Windows (including Docker and RPI 3/4/5)
  • JIT-compiled runtimes (ARM64 and AMD64)
  • REPL shell
  • LSP plugins for VSCode, Sublime, Kate, and more
  • API documentation

Libraries [2]

Features

Object-oriented

Inheritance

class Triangle from Shape {
  New() {
    Parent();
  }
}

Interfaces

class Triangle from Shape implements Color {
  New() {
    Parent();
  }

  method : public : GetRgb() ~ Int {
    return 0xadd8e6;
  }
}

interface Color {
  method : virtual : public : GetRgb() ~ Int;
}

Type Inference

value := "Hello World!";
value->Size()->PrintLine();

Anonymous Classes

interface Greetings {
  method : virtual : public : SayHi() ~ Nil;
}

class Hello {
  function : Main(args : String[]) ~ Nil {
    hey := Base->New() implements Greetings {
      New() {}

      method : public : SayHi() ~ Nil {
        "Hey..."->PrintLine();
      }
    };
}

Reflection

klass := "Hello World!"->GetClass();
klass->GetName()->PrintLine();
klass->GetMethodNumber()->PrintLine();

Dependency Injection

value := Class->Instance("System.String")->As(String);
value += "510";
value->PrintLine();

Generics

map := Collection.Map->New();
map->Insert(415, "San Francisco");
map->Insert(510, "Oakland");
map->Insert(408, "Sunnyvale");
map->ToString()->PrintLine();

Type Boxing

list := Collection.List->New();
list->AddBack(17);
list->AddFront(4);
(list->Back() + list->Front())->PrintLine();

Static import

use function Int;

class Test {
  function : Main(args : String[]) ~ Nil {
    Abs(-256)->Sqrt()->PrintLine();
  }
}

Serialization

serializer := System.IO.Serializer->New();
serializer->Write(map);
serializer->Write("Fin.");
bytes := serializer->Serialize();
bytes->Size()->PrintLine();

Functional

Closures and Lambda Expressions

funcs := Vector->New()>;
each(i : 10) {
  funcs->AddBack(FuncRef->New(\() ~ IntRef : () 
    => i->Factorial() * funcs->Size()));
};

each(i : funcs) {
  value := funcs->Get(i);
  func := value->Get();
  func()->Get()->PrintLine();
};

First-Class Functions

@f : static : (Int) ~ Int;
@g : static : (Int) ~ Int;

function : Main(args : String[]) ~ Nil {
  compose := Composer(F(Int) ~ Int, G(Int) ~ Int);
  compose(13)->PrintLine();
}

function : F(a : Int) ~ Int {
  return a + 14;
}

function : G(a : Int) ~ Int {
  return a + 15;
}

function : native : Compose(x : Int) ~ Int {
  return @f(@g(x));
}

function : Composer(f : (Int) ~ Int, g : (Int) ~ Int) ~ (Int) ~ Int {
  @f := f;
  @g := g;
  return Compose(Int) ~ Int;
}

Host Support

Unicode

"Καλημέρα κόσμε"->PrintLine();

File System

content := Sytem.IO.Filesystem.FileReader->ReadFile(filename);
content->Size()->PrintLine();
Sytem.IO.Filesystem.File->Size(filename)->PrintLine();

Sockets

socket->WriteString("GET / HTTP/1.1\nHost:google.com\nUser Agent: Mozilla/5.0 (compatible)\nConnection: Close\n\n");
line := socket->ReadString();
while(line <> Nil & line->Size() > 0) {
  line->PrintLine();  
  line := socket->ReadString();
};
socket->Close();

Named Pipes

pipe := System.IO.Pipe->New("foobar", Pipe->Mode->CREATE);
if(pipe->Connect()) {
  pipe->ReadLine()->PrintLine();
  pipe->WriteString("Hi Ya!");
  pipe->Close();
};

Threads

class CaculateThread from Thread {
  ...
  @inc_mutex : static : ThreadMutex;

  New() {
    @inc_mutex := ThreadMutex->New("inc_mutex");
  }
  
  method : public : Run(param : System.Base) ~ Nil {
    Compute();
  }

  method : native : Compute() ~ Nil {
    y : Int;

    while(true) {
      critical(@inc_mutex) {
        y := @current_line;
        @current_line+=1;
      };
      ...
    };
  }
}

Date/Times

yesterday := System.Time.Date->New();
yesterday->AddDays(-1);
yesterday->ToString()->PrintLine();
Versions
2024.4.1
2024.3.0
2024.2.1
2024.2.0
2023.12.0
23.11.2
Website