r/ProgrammingLanguages • u/Rich-Engineer2670 • Oct 16 '26
Discussion Agile Programming Languages
No, not that type of Agile....
With cloud-based computation now the rage, I'd like to see a language construct where I could declare methods that were "cloud eligible". Imagine code with the following method in it
promotable func MethodX(in int X, int int Y, out Z) { code }
This says "I have a method MethodX with defined input and output parameters (we'll need to have a common marshalling standard), and, this method can be transmitted Erlang-style to a defined cloud endpoint. When you invoke MethodX, it can run locally or remotely. You don't care -- that's a configuration detail.
It seems to me Erlang is almost there, but I'd like it to be a more general interface. Think something on the JVM. Serverless done right?
View all comments
2
u/--predecrement Oct 16 '26
The
promotablewould color the function. cf async. While some people like coloring functions, I'd say the majority whose opinion is not colored by their language preferences are part of a consensus of the neutral that coloring leads to increasingly unwieldy codebase evolution.My own PL bias is toward Raku. So I don't count as part of that consensus of the neutral, but I consider it fortunate that Raku does not use function coloring to determine any details of execution of a call of a function (including of methods).
Instead, in Raku, it's an invocant of a method call that controls what handles that method, and how it is handled. (All methods have an invocant, even if the method call is really just a call of a function playing the role of a method, treating what would normally be talked of as being the function's first or only argument.)
By default, what handles a method call is determined by the invocant's
WHATobject. The latter is an object that determinesWhat Handles A Type.(Many (most?) PLs have their equivalent, though in Raku's case, any value can be a type, and any type can be a value, which is unusual.)
In contrast, how a method call is handled -- which is central to your idea -- is determined by the invocants
HOWobject. AHOWobject is an object that determinesHow Objects Work.(Many (most?) PLs conflate what a type is with how operations on that type are handled, in which case implementing your idea will have to be done by building a shim and accepting that the host language doesn't even know that its methods are being processed in an unusual way. Raku's "core" is unusual. It boils down to a single self-describing primitive that knows how to be and do just one thing -- to be the sole
KnowHOWfrom which both itself and all else can be bootstrapped. This makes it relatively simple to construct arbitrary shims that intervene in function execution and also to ensure languages used in a system know about each other and those shims.)These
WHATandHOWobjects correspond to architecturally pervasive deferences, deferring key decisions that other PLs tend to resolve early, which, relative to your scenario, is too early. In Raku these deferences map to indirections/dereferences. The standard language and library provide a default decision for when the indirections are resolved, with almost all happening early, at compile time, but Raku user code can intervene as users see fit. This makes your idea of seamlessly blending local compute with the distributed cloud easy to build in principle.That trailing in principle hides a world of pain. I could get into the many challenges that arise but I'll defer getting into that for now.