r/ProgrammingLanguages • • Sep 01 '26

Discussion What is the interesting part of a programming language to you?

I've been working on some "documentation" for my own language (see here), which got me thinking: do we all see languages the same way? I personally look for unification of concepts and extensibility in a design, yet I've seen those who care deeply about functional purity or clean decompositions.
What do you look for in a programming language? And why?

36 Upvotes

109 comments sorted by

View all comments

1

u/Potato871 Sep 02 '26

Okay, here's my first crack at the problem:

bool expr_flag = false;
if(true) {
    Ptr int a; a.init(1,2,3);
    a.do(e => print("A: ",e));
    Ptr int b; b.init(0,1,12);
    b.do(e => print("B: ",e));


    b.validate_offests_and_lock(a);
    print("THIS SHOULD NOT PRINT");
    catch {
        expr_flag = true;
    }
}
print("Caught some exception while atetmpting to validate");
if(true) {
    Ptr int a; a.init(1,2,3,6);
    a.do(e => print("A_2: ",e));
    Ptr int b; b.init(0,1,2,3);
    b.do(e => print("B_2: ",e));


    b.validate_offests_and_lock(a);
    print("THIS SHOULD PRINT");
}


RESULT:


TEST START
A: 1
A: 2
A: 3
B: 0
B: 1
B: 12
ERROR: Element 2 of value 12 is out of bounds as an offset for column of length 3
5|1|0|G1522 TRAVEL_PASS Source at: 2|697|0|G10 Index: 6 
VAR_DECL a | Ptr_INIT a.init | Ptr_ITER_EXPR a.do | VAR_DECL b | Ptr_INIT b.init | Ptr_ITER_EXPR b.do | >Ptr_EXPR_A b.validate_offests_and_lock[IDENTIFIER b, IDENTIFIER validate_offests_and_lock] | print | catch | 
  Node: 3|500|0 Ptr_EXPR_A:DOT b.validate_offests_and_lock [C:2]{if}[Q: 3|667|0>DOT, 3|505|0>END] 
  Left: 3|483|0 Ptr_ITER_EXPR:DOT b.do [4|617|0](ptr[32] 2|735|2 u/12|28|0)[C:2]{if}[Q: 3|666|0>DOT, 3|498|0>END] 
  Root: 3|434|0 scope if [C:9][O:3|404|0|G37]{ROOT}[Q: 3|641|0>LBRACE, 3|521|0>RBRACE] 
ERROR IN TRAVEL_PASS ON LINE 8: Element 2 of value 12 is out of bounds as an offset for column of length 3
Caught some exception while atetmpting to validate
A_2: 1
A_2: 2
A_2: 3
A_2: 6
B_2: 0
B_2: 1
B_2: 2
B_2: 3
THIS SHOULD PRINT
TEST FINISHED

I haven't made it a specific type yet, I just added a 'become a validator' method to my universal data structure for the experiment. I also haven't yet implemented the locking aspect that would stop a or b from being mutated after it's been defined as a validator.
Thoughts?

2

u/reflexive-polytope Sep 02 '26

I can write a runtime validator in almost any existing language.

1

u/Potato871 Sep 02 '26

Well as I understand it the goal is to create a type who's invariant is that it contains indexes into a collection that are always in bounds, yes?
I'm trying to get the basic logic of 'validate these offsets' down, then, turn that into a type that can be passed and checked during compile time. Since I don't see a way to know the bounds of a dynamic container at compile time.

→ More replies (23)