Hi everybody.
First I have to say that I don't want to talk about D often, it is only now and I won't talk about it anymore, I'm just seeking for a language with good interfacing features when dealing with external C/C++/Objective-C code.
Here is D features when interfacing with Objective-C: https://dlang.org/spec/objc_interface.html
Is stated that it supports:
Does Nim has support for all these?
I know that there is this Objective-C wrapper already: https://github.com/jangko/objc But I want to know the native support for all that of D.
I'm about to choose a language and I wouldn't like to choose D because of its garbage collection it can be turned off but all the standard library support will be lost.
Does Nim has support for all these?
Nim can compile to Objective C so worst case, you can resort to
{.emit: """ /*obj-c code*/""".}
for what isn't supported.
I don't know if it currently supports everything, but you won't be limited by the absence of support since you can add it.
I'm about to choose a language and I wouldn't like to choose D because of its garbage collection it can be turned off but all the standard library support will be lost.
What do you need? Is it no GC, deterministic GC or no heap allocation? And what part of the standard library do you need?
If no heap allocation, apart from math/posix/winlean/locks/atomics and system/ansi_c most stdlib require heap allocation for strings, sequences and exceptions.
If you want deterministic memory management, make sure to use --mm:arc
If no GC at all, use custom types object and ptr object.
nim can technically "compile to Obj-C" and produce loose method calls through {.importObjc.}, found here in the docs. however this interface is pretty much one-way: e.g. you can't subclass in pure nim this way, which is a huge bummer as AppKit/UIKit expects you to subclass and override frequently; but to say you can't subclass at all in pure nim code is wrong.
one of the critical things about using Obj-C is (aside from the official Obj-C/Swift compilers themselves that have special less-than-documented abilities, e.g. the static baked-in selector stuff for optimization) that Apple/NeXT built its dynamic runtime interface through what is more or less "just a C library." in fact: Dlang's Obj-C support is very much built through that C API. at this point you would be transferring your concerns out of the compiler into the DSL realm.
I need a programming language that let me to use both the standard library and no-GC. I think I will need everything in the standard library because I'm planning to write several programs in the future.
Do you know if I could work with Objective-C protocols in Nim?
I think I will need everything in the standard library
Are you really planning to use ?
I've been using Nim for years to write everything from DNS servers to graphical user interface programs and even a window manager. You definitely won't need all of the standard library, there's tons of stuff I've never even looked at in there. Unless you're writing an entire operating system from the bottom up with all the bells and whistles I doubt you'd use all of it (and even then it might be a hard squeeze).
I'm also curious why you dont want to use the garbage collector. They do have a bad reputation, but the Nim one is really good, and can be tuned to fit pretty much anything. I've even run ARC on an ATMega32u4 without any issues. It sounds a bit like you have a checklist of things you want to check, with little thought about the actual items on the list.
I'm also curious why you dont want to use the garbage collector.
I will attent to Computer Engineering bachelor's course (it is this name in my country) and I will do a lot of low-level stuff, and I also like the C performance, Nim without a GC is as fast as C.
It sounds a bit like you have a checklist of things you want to check, with little thought about the actual items on the list.
No, I just wanna to know which language has the best interfacing with C-trio (C/C++/Objective-C). D seems to have a (presumable) full-featured C-trio interop, but don't let to disable the GC without losing access to standard library.
Also, I wanna to choose only 4 languages to learn, I think C, C++, Objective-C and Nim, I'm not a person who likes to choose a dozen of PLs to master. C, C++ and Objective-C will be the "read-only" languages, and Nim, my main language that will stay with me forevel until I die.
I'm only 16 years old (but I know how to make complex shell-scripts), I can sound amateur and childish, but all that I want is to choose a language that is really overkill.
I don't want to bump this topic anymore, for all that replied, thank you very much.
I decided today, my life's language will be Nim, it is expected that in the next year after learning a bit about C/C++/Objective-C I will introduce in the language and master it one day.
=)
While I appreciate that you decided on Nim, I will repeat what others said: Don't think in terms of "no GC vs GC", it's useless, especially for Nim which offers kind of a continuum.
"Oh, low level, I cannot use a GC here!" - "Maybe, maybe not. I bet you can and you're simply repeating bullshit you read online."
Btw when you program "low level" you might not be able to use floating point arithmetic yet somehow this topic never comes up...