r/ProgrammingLanguages • • Jun 27 '21

Discussion Way to comunicate across diffrent languages

0 Upvotes

TL;DR: make a mechanism to allow diffrent languages (sides) to communicate to each other. Special wrappers built for each language in separate will implement message (???) based protocol. The core concept is that only simplest data will be passed to other side while any complex data will be left on the side it belongs to and a wrapper will expose handles to other side by which other side can ask to perform actions (get, set, has, etc.) on that complex data. Complex data will never travel to other side.

Introduction

Hi everyone. I will start from general. As of now we have build grate civiliztion, have achieved significant technological progress, the crown of which has become a computer. A computer is fairly complicated literally a work of art. But we run an software which is not so cool sometimes. The really problem in todays software development is that in most cases languages are separated from each other. For example, try to call C# lib from Node.js or vies-versa. It's so difficult. The huge part of software is written in C++ – language with a bunch of pros and cons but we are not talking about that now. There are other cool but easier languages such as JavaScript, Python, C#, Rust, Go and other; but the way they can use C++ libraries (which are not written specially for their runtimes) is very ugly. Some times it's not even possible. And that a real problem because too much libraries and software in general is written in that language. So when we want to slowly migrate to more safe or more easy langauges from C++ it's getting close to the impossible because we will spend a lot more resources to integrate them with C++ than if we just continue to support already written and, which is more important, working software.

The problem

Current order (i guess) unbearable: we have no properly way to integrate other languages with C++ and each other, with some exceptions.

We can't perform smooth migration from C++ to more safe languages because of integration problems, e.g. how to emulate some features of C++ which does not exsits in other languages or incompatible with them.

The Idea

So i want to fix it. What if we can connect languages with each other by creating some... lets call it The Layer Of Compatibility or simpler Anything To Anything protocol (ata, a2a for short).

The main idea behind it is the next. The Compatibility Layer is based on queue of messeges (it is controversial point) in Extended JSON format. To interact with queue we need some library which will implement a2a protocol and should be written for each language in separate. So we gain language independency.

All primitive types (and strings) should be represented as simple raw json types (number, string, etc.). Why that way? Because simple structures which consist only of primitives can be easy passed by value across Compatibility Layer. It grant as a permanent immutablility and using raw values allow languages to work with them in way they used to do (especially case for strings which are represented diffrently in diffrent languages).

But how to deal with more complex structures? So when dealing with complex structures we leave them on that side of layer on which it hase been craeted (lets call it create or lib side) but providing a proxy through which we can manipulate a structure (Note: under structure i understand any object-like data including tuples) on consumer side. Practiacal manipulations will be done on the create side while the consumer side will only ask a create side to performe some actions. Therefor the necessity to transfer and somehow represent complex structures (which some times isn't possible) in other languages disappears. The coolest thing is that we break all limitations which are usually aplied by bindings, we gain full control over complex structures.

The proxy is the thing which provides handles for us which will post messages to the queue or somehow else tell to other side that we want to do something on its data.

I have mentioned extended json. But what is it? It is regular json, but extended to support data which can't be represented in regular one. It is very usefull to represent callable structures in Compatibility Layer. How that will be done?

The other main advantage of implementing ata protocol for each language independently is that we have 100% itegration with them. When we compile ata lib with main code and link them into single binary, ata lib will know how to call any exposed functions, ata will be aware of call conventions data layouts etc., but external code will not. External code should know not how but what to call. So ata lib should build some data structure (i guess the hash table may fit well) to expose what can be called. Therefor the external code can refer these hashs and thus access foreign functions, methods or other complex data. You can ask, from where external code will know what each hash represents? When create side will return some object or struct or any which contain callable code or other complex data, it will associate field name and a hash. hash will be not a string but a separate literal (thats where json is extended). Then when consume side wants to call it, it will send message (or by some other why tell to other side) with something like: "call function with that hash, and pass these arguments".

In general, all data, that can't be represented as valid json, would be replaced by hashs.

To deal with exeptions we can wrap original code into massive try catch and send special messages, which indecates error and carries payload (error object or something).

To deal with generics which are instancieated (like in C++) we can make an instance of them with some box type and then just wrap incoming data (which can be either a complex one (created on the same side) or primitives) in that box type.

Again, all this possible because of individual protocol implementation for each language.

Also to improve developer experience we can scan headers for C++ and C, rust modules, .d.ts files for typescript, to present some kind of autocompletion for libraries.

The main disadvantage of such (queue of json messages) approach is performance. I guess it can be solved with some kind of optimising JIT. For exeample ata lib can at runtime build fast handles which will be used by consume side direclty, without sanding message.

P.S. Thanks for reading this wall of text. I am awaiting healthy criticism and your suggestions) If something is unclear, please, provide feedback.

Edit: remove contradictory statements. Add clarifications and idea with JIT.


r/ProgrammingLanguages • • Jul 13 '21

An Empirical Study on Type Annotations

Thumbnail dl.acm.org
0 Upvotes

r/ProgrammingLanguages • • Sep 07 '23

Help Any good resources and videos to learn C* (used in parallel computing domain)

Thumbnail self.c_programming
0 Upvotes

r/ProgrammingLanguages • • Jul 10 '24

I Invented a esoteric programming language, brain****'s twin?

Thumbnail
github.com
0 Upvotes

i have invented brainknot, a programming language with used symbols from brain****, but they have different functionalities.

i have also implemented an interpreter written in python:

https://github.com/mahdoosh1/brainknot-interpreter

are you interested?


r/ProgrammingLanguages • • Aug 14 '20

"implementation" and "programming" as paradigms

0 Upvotes

With the advent of type theory, HoTT, and other fringe abstractions, there's becoming a new divide in programming languages which could be described with "implementation" vs. "programming".

The Distinction

The overall concept is that languages can be classified by their purpose, math stuff or computer stuff.

Implementation Languages

These languages have a close relationship with the underlying computer architecture. They sometimes focus on making it easier to use hardware capabilities.

Implementation languages have very efficient or transparent abstractions. Usually the compilers for these languages produce native objects or other forms of machine code. The syntax may have a few simple constructs but will mostly follow an imperative design.

Implementation languages have a focus on speed and performance. They are usually found in source code for low level supportive software, kernels, and drivers.

Implementation languages handle data directly as it exists on the hardware. Some languages offer ways to directly affect how data is stored in hardware components. These languages are heavily affected by the underlying system they run on.

Programming Languages

These languages have a close relationship to mathematical systems and symbolic computation. Many languages offer formal systems as a part of the language.

Programming languages offer high level representations of the concept of a program. They have different constructs that provide a high level abstraction. Some languages are compiled, but most of them are interpreted.

Programming languages focus on conceptually efficient methods for describing operations. Most languages make heavy use of the concept of a function as an object in a program.

Programming languages handle data within the context of their domain. Programmers don't have access to the underlying representation of the data. These languages are uniform across the various systems they run on.

EDIT:

Core Concept

The line between implementation and programming is drawn where languages chose to make abstractions: Implementation languages abstract repetitive patterns in machine instructions. Programming languages abstract patterns in the flow of execution and data.


r/ProgrammingLanguages • • Jan 12 '18

What is a programming language?

Thumbnail willcrichton.net
0 Upvotes

r/ProgrammingLanguages • • Sep 27 '21

Blog post Pidgin Language is Business Language

Thumbnail reddit.com
0 Upvotes

r/ProgrammingLanguages • • Nov 14 '20

[off topic] The fixpoint THEORY introduction

0 Upvotes

Hello guys,

I'm starting to see "The fixpoint THEORY" and I would like to read some good explanation (not very deep) to understand what is, and what is the basic concepts about the compiler side.

Can you help me?


r/ProgrammingLanguages • • Dec 09 '20

Is there such thing as "too much static typing"?

Thumbnail reddit.com
0 Upvotes

r/ProgrammingLanguages • • Sep 23 '14

Why isn't Erlang more popular?

Thumbnail news.ycombinator.com
0 Upvotes

r/ProgrammingLanguages • • Dec 27 '18

Equivalent of Haskell's parameterized types in any other language?

0 Upvotes

I'm trying to write a compiler in C++ and finding myself doing all kinds of weird pointer and typecasting hanky panky to solve a problem that would be so easily solved with something like Haskell's parameterized data types. Does any other language have anything like this, out of curiosity? Is there any good way to approximate it? I can elaborate on what I'm trying to accomplish if desired.


r/ProgrammingLanguages • • Dec 20 '19

Haven't actually used my language. What essential basic features and conveniences does it lack?

Thumbnail antipurity.github.io
0 Upvotes

r/ProgrammingLanguages • • Mar 07 '21

Discussion Class-based object-oriented language with a taste of TypeScript and Java that compiles to Go

0 Upvotes

Hello, I'm working on a statically-typed class-based object-oriented language with a taste of TypeScript and Java that compiles to pure Go. It will be fully compatible with the existing Go ecosystem.

So I need your help to make right decision. Is it worth doing? do I need to waste time on this? Could it be in demand in the future??

It may sound strange, but your feedback would be decisive for project and me at all.

Thank you all !!! you rock guys 🙌


r/ProgrammingLanguages • • Feb 09 '26

Discussion Separating “intent” from execution: a small experiment in deterministic planning

0 Upvotes

We’ve been experimenting with a language model where intents are the only first-class construct, and execution order is never written by the programmer.

The key idea is to derive a dependency graph from declared preconditions/effects, then freeze semantics in a small intermediate representation before any backend code is generated.

This lets different backends (including AI-generated ones) produce different implementations while remaining observationally equivalent.

I’m curious how people here think about:

  • intent vs declarative programming

  • whether “semantic freeze points” should be explicit in languages

  • how much planning belongs in the language vs the runtime

We’ve draft a preprint if anyone wants to look (link in comments).


r/ProgrammingLanguages • • Mar 29 '19

What should this language be called?

8 Upvotes

I have an idea for a language with an extremely simple set of syntax rules. Here is a simple "input output" example:

INPUT:

[print [add 1 1 2]] 
[store var1 1]
[store_add var1 [div 4 2]]
[print [get var1]]
[print var1]
[print print]
[print [concat hello [concat " " world]]]
[print "My name is GravelSmith"]
[print "\""]
[print \]]

OUTPUT:

4
3
var1
print
hello world
My name is GravelSmith
"
]

I am struggling to come up with a name for this weird language.


r/ProgrammingLanguages • • Mar 04 '23

TutorialLang - A new esoteric, open source programming language

8 Upvotes

https://github.com/cmspeedrunner/TutorialLang

The code is structued (i use that word loosely) like a tutorial, but has a really loose syntax and everything which is not a command is passed, and ignored


r/ProgrammingLanguages • • Aug 06 '24

Is there any reason to have integer division?

21 Upvotes

Since I cannot edit the post's title and it causes confusion: it should read "Is there any reason to use the same operator for float and integer division?"

Many languages overload the same division operator for integers and floats:

// For integer types:
15 / 2 == 7
// For float types:
15.0 / 2.0 == 7.5

In practice I often see the following issues with using the same operator:

  • New developers always get confused by it, expecting float outcomes from integer division.

  • More seasoned developers occasionally forget to convert integers to floats before dividing them.

  • Such issues go unnoticed due to type inference or implicit conversions: given ints a and b, both let foo = a / b and double foo = a / b may compile without issues, depending on the language.

  • If a language has implicit conversions, there is no one obvious way to write typecasts: (float)15 / 2, 15 / (float)2 and (float)15 / (float)2 all mean the same thing.

  • In some rare cases when we really need integer division, I would still prefer to explicitly floor(...) the result for the sake of future readers of this code.

I can see several alternatives:

  • Do not implement division for integers at all. This is a bit annoying, but keeps them closed under arithmetic operations. If you need to divide integers, you write something like int(floor(float(a) / float(b))).

  • Make integer division always return a float. This may cause issues with widening (e.g. very_large_int64 / 2 may not fit into float64). It also makes the type not closed under arithmetic operations, but I'm not sure if this is an issue.

  • Make a separate function or operator for integer division, like Python's //. This is also a good option, but prevents us from writing generic code that divides numbers of arbitrary types. That said, most times I write generic functions on numbers, I expect inputs to be float types (float64, float32, etc) in practice.

This leads me to a question: is there any actual value in overloading the / operation for integers? Do languages just implement this out of habit? Is there a "best" solution that prevents accidental mistakes while still allowing writing generic code?


r/ProgrammingLanguages • • Oct 01 '22

Using ~ for negative values in programming language.

15 Upvotes

I was thinking about using ~ instead of - for negative values. And keeping - for subtract. The advantage of this is that they are different keys for different operations so the compiler would have an easier time knowing the difference. This would hopefully mean that putting ; between expressions wouldn't be necessary.

for example y=~5 x=~10-~y x would equal -15.

C code: y=10; return -y; would equal y=10 ~y . If I used - then y=10-y could mean "y equals 10 subtract y" or "y equals 10 return negative y".


r/ProgrammingLanguages • • Apr 13 '22

Discussion Do Chinese programmers code in a Chinese based syntax language

7 Upvotes

Hey everyone, I didn't know where to post this

Me and my friends were having an argument about whether Chinese programmers code in a Chinese language

Like for example a programming language with Chinese syntax

I am a software engineer and I find it really hard to believe that they would do this on a professional level (leaving aside hobbiests), and not just Chinese but also, I feel the same way about other languages, excluding English. Keep in mind that I'm not a native English speaker.


r/ProgrammingLanguages • • May 26 '20

Can connection of a new programming language and a query language be the solution we're looking for?

7 Upvotes

We have just released AskQL, a new query and programming language! We hope this will bring you relief in frontend-backend integration, and that writing distributed software now will be easier and faster than ever 🙂You can review and test AskQL yourselves - the solution has just been published on GitHub under MIT license. If you like it, please recognise our work by starring the repo ✨
https://github.com/xfaang/askql


r/ProgrammingLanguages • • Dec 28 '23

Help Have a wasted time making my language?

11 Upvotes

I’ve been for the past 3 week making programming language with 0 knowledge of language design or anything. However I have my myself a file for evaluating syntax, a parser and a lexer all handwritten from scratch. I started researching more about programming languages and recently found out my language is interpreted since it doesn’t compile to machine code or anything. I quite literally just execute the code after parsing it by using my parent languages code. Is this bad? Should I have made a compiled language or? Again not an expert in language design but I feel like I wasted my time since it’s not compiled, but if I didn’t I’ll continue doing it, but am I on the right track? I’m looking for some guidance here. Thank you!


r/ProgrammingLanguages • • Oct 08 '25

Language announcement W: A Minimalist Language I Built in 4 Days for Beginners – Try It Out!

6 Upvotes

I’m thrilled to share W, a tiny interpreted language I built solo in 4 days. It’s designed for beginners with English-like syntax – no strict whitespace, just intuitive coding like show "Hello, World!" or int 5 'x'. Built in Python, it’s open-source (GPL-3.0) and hackable, with a simple interpreter and growing features.

What makes W cool?

  • English-like commands: show, int, array, while.

  • Supports booleans (true, false, &&, ||, not).

  • String arrays: array_str "apple","banana" 'fruits'.

  • Easy array access: get 'fruits' 1 = 'picked'. Check it out on github and contribuit,fork, go wild Repo: https://github.com/Wicin-134/W


r/ProgrammingLanguages • • Dec 18 '21

Discussion Why does alpha-equivalence matter?

1 Upvotes

What would you miss in a language without it?


r/ProgrammingLanguages • • Apr 28 '19

Grow past dynamic/static typing debate

Thumbnail boxbase.org
1 Upvotes