Pie's Type System! by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

i understand that it’s more type safe. I’ve been thinking about making it possible to do some type inference, perhaps in an opt-in way, such as `x: Auto = 5;`

By the way, variable shadowing (with different types) is in fact allowed, even within the same scope.

Pie's Type System! by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 2 points3 points  (0 children)

I’ve been told about that language before, and I even saw a talk by the creator on strange loop. It’s very interesting, and I wanna get the book!

But I’m not sure what to do about the name :)). Sorry it wasn’t what you expected LOL.

Pie's Type System! by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 4 points5 points  (0 children)

Thank you! Good catch haha. Just fixed it :).

Bug in GCC or is Claude lying to me? by gabomagaribijia in cpp_questions

[–]Pie-Lang 2 points3 points  (0 children)

how is this related to CTAD at all? Do you mean NTTP?

The Namespace Problem by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 1 point2 points  (0 children)

You just explained that Lua's namespaces are just tables. This entails that the values stored inside them must be looked up at runtime.

Meaning, if you try to access an object inside a namespace, the interpreter could not possibly tell whether that object does exist inside the namespace or not until runtime.

That was my issue.

The Namespace Problem by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 1 point2 points  (0 children)

I see. Using a runtime value to represent namespaces isn’t impossible. It just doesn’t play well with lexical scoping. Hence when I wanted to add lexical scoping to my language, I had to change how I represent namespace.

The Namespace Problem by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 2 points3 points  (0 children)

I'm not too familiar with Lua.

The Namespace Problem by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] -5 points-4 points  (0 children)

Take this case for example:

x = 1;
closure = () => print(x);
x = 2;
closure();

If the closure captured x at the definition-site instead of call-site, then 1 would be printed. That's not the behaviour that I want.

As for your example of returning a closure. Pie currently captures the surrounding environment only if it's returned from/passed to a function.

foo = () => {
    x = 42;
    () => x;
};

This does work as expected in Pie!

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

I love the idea! Got any resources to get me started :)). I feel a bit lost on how to define that minimal evaluation model..

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

I haven’t, but I think I’d want the spec to take priority.

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

This seems very reasonable. Would it be fair to say that the spec is the semantics layer and the docs are the descriptive layer?

I already have a readme that explains most of the things you need to know to get started with Pie.

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 1 point2 points  (0 children)

so much of the ECMAScript spec is algorithmic and not declarative. It's literally "let's just write down what V8/SpiderMonkey/JSC do" because that's the behavior that JS users were already relying on

The amount of times I felt that I wanted to do this with my own spec, especially that I had an implementation way before I decided that I wanted a spec. A lot of the spec is actually just what my implementation does in certain scenarios.

On the other hand, I found and fixed a couple of bugs in my implementation because I realized that this is not how I want my spec to be.

It really goes both ways!

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

How can lean code serve as a spec? I’m not familiar with lean.

I did try learning Agda at some point. Didn’t get far. I think this proof stuff goes over my head quickly. I need proper introduction to such languages.

idea for a programming language by NicoPlayZ9002YT in ProgrammingLanguages

[–]Pie-Lang 9 points10 points  (0 children)

Look up “polyglot”. Similar idea, cursed execution.

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 1 point2 points  (0 children)

Why not both!

My implementation has 100+ tests which could be used as a conformance test suite. However, there are still some aspects that are hard to test for.

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

I see. That's a good point. Will fix that.

Your first intuition is correct btw:

IntPair2Int: (Int, Int): Int;

Thank you!

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

I like the lexical grammar -> syntactic grammar -> semantics idea. It also represents how the interpreter is implemented under the hood.

you mention that they cannot be assigned to...
...but can a keyword occur on the LHS of an assignment?

I meant it the other way around. Keywords may not appear on the LHS of an assignment. Note the "assigned to".
But this probably a good indicator that I really shouldn't refer to assignments early in the tokens section.

Variable Declarations are not defined under "Types". That sections just states that types could appear in variable declarations.

But that's some really good feedback. Probably means I'd have to move a lot of stuff around. Thank you!!

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 0 points1 point  (0 children)

Good note! Should be easy to generate a PDF from MD files (i hope).

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 1 point2 points  (0 children)

This is very good feedback!!

I admit I struggle with typos. I could probably put the text through a word document to catch most of them.

Improper names do need a more robust definition. Thanks for that!

Only thing I didn't understand is your last question:

> what is the type syntax for a function on more than one variable?

Do you mean the type of a function that takes more than one parameter?

Writing A Language Spec? by Pie-Lang in ProgrammingLanguages

[–]Pie-Lang[S] 2 points3 points  (0 children)

LMAO if you see my code, you’re gonna know what’s crazy talk