[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology


Thread archived.
You cannot reply anymore.


[Advertise on 4chan]


File: 1765632699352.png (72 KB, 800x419)
72 KB
72 KB PNG
If your language does not have this, lower your tone when talking to me
>>
>>107536550
SHUTUP FAGGOT
>>
>>107536550
>he cares about the intricacies of programming languages in a time where you just vibecood what you want in whatever language makes the most sense
oh no no no no
>>
File: forth-inc.png (18 KB, 261x234)
18 KB
18 KB PNG
Your language can't compile code at runtime?

Wait, it can't even run code at compile time!? Why do you put up with this blub bullshit? Even Zig can do that!
>>
>>107536550
It's not often I see another Julia programmer here.
>>
>>107536550
This is one of those features you can't appreciate until you design a library that makes use of it. When it finally clicks, it feels like a huge revelation. Things that were awkward to model with traditional OO become straightforward with multiple dispatch. You also get very fine grained control over polymorphism that would be unimaginable before, but now it's easy.

People who haven't tried it don't know what they're missing.
>>
>>107538733
Conversely, this is one of those things that feels only until you get bitten by it, and then you spend your time making sure each one is calling the exact signature you expect, until you realize that you could've just given them different names all along.
This Cycle is eternal, I'll see you here on this side eventually.
>>
>>107538624
OP pic shows Julia and it is JIT compiled though
>>
>>107536550
This looks like a description of method overloading
also I can't think of a single language where multiple dispatch is not possible
>>
File: C_User.jpg (21 KB, 735x884)
21 KB
21 KB JPG
glUniform1f
glUniform2f
glUniform3f
glUniform4f
glUniform1i
glUniform2i
glUniform3i
glUniform4i
glUniform1ui
glUniform2ui
glUniform3ui
glUniform4ui
glUniform1fv
glUniform2fv
glUniform3fv
glUniform4fv
glUniform1iv
glUniform2iv
glUniform3iv
glUniform4iv
glUniform1uiv
glUniform2uiv
glUniform3uiv
glUniform4uiv
glUniformMatrix2fv
glUniformMatrix3fv
glUniformMatrix4fv
glUniformMatrix2x3fv
glUniformMatrix3x2fv
glUniformMatrix2x4fv
glUniformMatrix4x2fv
glUniformMatrix3x4fv
glUniformMatrix4x3fv
>>
>>107539419
It is a form of method overloading, but these generic methods don't belong to any class. Some languages like Julia do away with the concept of class altogether. Methods are dispatched based on the types of each argument.

Most OO systems are single dispatch.
object.method(a, b)
That one object represents the "single" in single dispatch.

Multiple dispatch makes every argument just as important as the leading object in single dispatch.
https://youtu.be/hesjQz__yb8
https://www.youtube.com/live/kc9HwsxE1OY
>>
>>107538733
For which functions you ended up using multiple dispatch/function overloading?
>>
>>107539212
>Conversely, this is one of those things that feels only until you get bitten by it, and then you spend your time making sure each one is calling the exact signature you expect, until you realize that you could've just given them different names all along.
Not necessarily. This only happens if the language has a notion of ordering or subtyping concerning the variants of the overloaded functions. A language could very well have function overloading and fail to compile if more than 1 function candidate has a matching signature.
If that happens you could indicate at the function call site which function variant you want to call.
>>
>>107539683
https://github.com/bhftbootcamp/LightweightCharts.jl/issues/7

This is a simple example, but it's a common one. Pluto.jl is a notebook system for Julia. LightweightCharts.jl is a library for generating financial charts. It didn't initially support Pluto, but adding support was just a matter of implementing a Base.show method for the mime type text/html and various displayable structs from LightweightCharts.jl.

The really convenient thing was that nothing had to be coordinated with the Pluto.jl team. Any library that implements an appropriate Base.show will automatically work with Pluto.jl.

Another nice thing was that Jupyter notebooks use the same Base.show, so we got Jupyter support at the same time.
>>
>>107536550
if your language has this, get ready for ass to mouth
>>
>>107539718
>you could indicate at the function call site which function variant you want to call
You know how else you can do that? By giving them different names.
>>
>>107536550
You don't actually need this, you are cheering for fake progress, you just add confusion, the compiler gives your functions the different names that you refused to give them, you are just detaching yourself from the reality of what's really happening.

>>107539561
based
>>
>>107539212
If you have issues with that it means you cannot handle types and you should go back to javascript or whatever flavour of jeet language is in vogue among retards
>>
>>107536550
>>dispatching functions whenn you can just compile them with different names and compiler will change the calls for you
>>
https://en.wikipedia.org/wiki/Multiple_dispatch

Not mentioned in the wik pagei, but Emacs Lisp can do multiple dispatch too.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Generic-Functions.html
>>
File: file.png (61 KB, 607x495)
61 KB
61 KB PNG
>>107542698
correction. it was briefly mentioned.
>>
File: file.png (28 KB, 555x168)
28 KB
28 KB PNG
https://julialang.org/
https://en.wikipedia.org/wiki/Julia_(programming_language)
>>
>>107538733
libraries should be written in C, all languages can interop with C without friction. C++ mangling is implementation defined and never stable.
>>
>>107536550
This is some kiddies first scripting language kind of feature wtf are you talking about?
>>
>>107536550
that must be a terrible example because all statically typed languages can do this
>>
>>107545881
>libraries should be written in C, all languages can interop with C without friction.
C forces everyone else to have special rules (FFI) to interop with C because C does not have natural compatibility with the other languages. C mandates null-terminated strings, which real languages don't use. C mandates array decay, which isn't real arrays. "Interop with C" is not natural.
>>
>>107546711
>natural compatibility
It's the other languages who have no compatibility with established languages like C.
>... which real languages don't use
Their problem.
>>
>>107546480
There's that keyword "runtime types". Multiple dispatch does the passing to most suitable method in runtime.
>>
>>107542669
That's what julia does THOUGH but (You) don't have to do it
>b-but I CAN do it
do you manually set bits for your program? No, you offloaded that to a compiler. Compilers and languages can do more, you offload more work and write less LOC. Simple as.
>>
>>107546480
dumbass >>107539561
>>
>>107546820
>There's that keyword "runtime types".
useless, harmful and niggerlicious
>>
>>107546787
>It's the other languages who have no compatibility with established languages like C.
C broke all the compatibility with established languages like FORTRAN, COBOL, ALGOL, BASIC, and PL/I. For example VMS has descriptors for arrays, strings, labels, procedures, and other data types that work for all the languages that were around at the time, and are similar to how newer languages like Common Lisp, Python, Java, and JavaScript do strings, arrays, and functions or procedures, but C can't use them. These descriptors were designed for natural interop between languages, but C had to be a special snowflake and force everyone who wants to interop with C to do things the unnatural C way, when the other languages were just naturally compatible by picking the same convention for the same data types they all shared.
https://bitsavers.org/pdf/dec/vax/archSpec/VAX-11_System_Reference_Manual_Rev5_Feb79.pdf
>>
File: 1741388659153229.gif (1.89 MB, 300x350)
1.89 MB
1.89 MB GIF
>>107546897
>>
>>107540269
>Pluto.jl
You will never be a planet.
>>
>>107547112
but ur anus will.
>>
>>107546955
really a shame we live in a world where guys like you talk common sense but thats ignored because somehow every idiot has to blindly follow unix standards
>>
>>107548064
The designers of VMS figured that out in the 70s and VMS still does this. The VAX/VMS manual I posted actually has examples of different languages and how they would use the instructions and descriptors provided by the CPU and OS. All the languages have types that are basically the same and need the same features, so there's literally no point in not having them use the same format for them. It's just a simple common sense idea. The idea is actually similar to what Microsoft did with .net, except the VAX is designed for assembly and languages of the 60s and 70s like COBOL and FORTRAN, and .net is designed for managed languages with garbage collection. A .net array is an array whether it's from C#, Visual Basic, PowerShell, or any other language, and you can share types and call functions and methods written in any .net language.
>>
>>107548064
>>107549028
Also, Dave Cutler who designed the Windows NT kernel was one of the designers of the VAX and his name is in that book.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.