julia,

Feeling the need to make my own programming language again 🥴

julia,

Mockup:

@!feature(alloc)

import std::alloc::{Allocator, GlobalAllocator, Layout, handle_alloc_error};
import std::mem;
import std::ptr;

export struct{T, A = GlobalAllocator} Vec
where
  A: Allocator,  
{
  allocator: A,
  capacity: usize,
  content: *unique [T],
  length: usize,
}

export function{T} Vec.new(): Vec{T}
begin
  {
    allocator: GlobalAllocator,
    capacity: 0,
    content: unsafe ptr::null_unique(),
    length: 0,
  }
end

export function{T, A} Vec.new_in(allocator: A): Vec{T, A}
where
  A: Allocator,
begin
  {
    allocator,
    capacity: 0,
    content: unsafe ptr::null_unique(),
    length: 0,
  }
end

implement{T, AA, AB} Clone{AB} for Vec{T, AA}
where
  AA: Allocator,
  AB: Allocator,
begin
  type{:a} Cloned = Vec{T, BB};

  try{AB::Error} function{:a} clone_in(*:a self, allocator: AB): Self::Cloned{:a}
    if self.content.is_null() then
      return {
        allocator,
        capacity: 0,
        content: unsafe ptr::null_unique(),
        length: 0,
      };
    end

    let content = allocator.allocate(Layout::array{T}(self.capacity)?)?.cast{[T]}();
    
    ## if T.implements(Copy) then
      (unsafe content.as_mut()).copy_from_slice(unsafe self.content.as_ref());
    ## else
      (unsafe content.as_mut()).clone_from_slice(unsafe self.content.as_ref());
    ## end

    {
      allocator,
      capacity: self.capacity,
      content,
      length: self.length,
    }
  end
end
a13cui,

@julia you almost had me thinking this is a cursed version of Pascal, but alas this is a cursed version of R*st

0x454d505459,

@julia Juliang, a general purpose, statically typed trans programming language. Juliang is able to able to transition (transpile) to and from Rust as well as offering an insane interop with it. Learn more at insertdomain.nyame/Juliang !

Im not sure about the mascot, maybe a blahaj or a Julia plush.

mai_lapyst,
@mai_lapyst@soc.saiyajin.space avatar

@julia Know that faaaar to well lol (Actually have already written code laying around that somehow uses LLVM and actually dosnt burns the whole building down when started lol), but qwq so many other projects also laying around that are soooo interesting q.q x3

Any idea yet from which one you want to draw inspiration from?

julia,

@mai_lapyst I wanna draw inspiration from nelua, rust, and julia

mai_lapyst,
@mai_lapyst@soc.saiyajin.space avatar

@julia Nice collection there. Do not know nelua at all, maybe something to look into xD

And julia I only know from the name and that its pretty math focused xDD

I guess rust bc of the ecosystem (cargo etc), the macros and/or just the borrowchecker?

julia,

@mai_lapyst Rust more because of its standard library design

mai_lapyst,
@mai_lapyst@soc.saiyajin.space avatar

@julia Yeah thats also better than most other systems languages (mainly c/c++ lol) ^^

Only the way the module systems works annoyes me sometimes xD

mia,
@mia@void.rehab avatar

@julia excited for julia's lisp dialect

julia,

@mia I don't think that'd work tbh

julia,

The trouble with this is that I really like rusts borrow checker, and don't wanna make a language without one

Andres,
@Andres@mastodon.hardcoredevs.com avatar

@julia
Someone beat you at it:
https://kittenlang.org/

julia,

I kinda wanna do like nelua but different

cheri,

@julia <Julia-lang joke here>

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • osvaldo12
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • tester
  • khanakhh
  • everett
  • thenastyranch
  • Youngstown
  • slotface
  • tacticalgear
  • kavyap
  • ethstaker
  • mdbf
  • anitta
  • GTA5RPClips
  • ngwrru68w68
  • provamag3
  • Durango
  • rosin
  • cisconetworking
  • normalnudes
  • modclub
  • megavids
  • cubers
  • Leos
  • JUstTest
  • lostlight
  • All magazines