[HN Gopher] GCC now includes Modula-2 and Rust. Do they work on ...
       ___________________________________________________________________
        
       GCC now includes Modula-2 and Rust. Do they work on OpenBSD?
        
       Author : solene
       Score  : 99 points
       Date   : 2022-12-19 18:19 UTC (4 hours ago)
        
 (HTM) web link (briancallahan.net)
 (TXT) w3m dump (briancallahan.net)
        
       | bentt wrote:
       | Modula-2! Now that's a name I've not heard in a long time. A long
       | time.
        
         | SoftTalker wrote:
         | Indeed. Used it for one semester in my undergrad CS program.
        
       | oytis wrote:
       | Wonder who had enough motivation and time for Modula-2 work.
        
       | anonymousiam wrote:
       | Very cool. Pascal can be compiled with GCC by feeding it through
       | the p2c front end. Obviously this isn't native support, but it's
       | something!
       | 
       | http://users.fred.net/tds/lab/p2c/
       | 
       | and more here:
       | 
       | http://www.garret.ru/ptoc/Readme.htm
       | 
       | http://freesourcecode.net/cprojects/94701/Pascal-to-c-conver...
       | 
       | https://web.archive.org/web/20060426224216/http://directory....
        
       | doomrobo wrote:
       | My guess is println! wasn't defined because the std crate isn't
       | supported for the OpenBSD target yet
        
         | saghm wrote:
         | From looking at the supported platforms, the standard library
         | seems to work for most OpenBSD targets, but they don't provide
         | official builds (presumably due to not having anyone
         | volunteering to maintain dedicated hardware for them to use for
         | CI); the Tier 3 platforms[1] list OpenBSD on x86_64, i686,
         | aarch64, sparc64, powerpc64, and riscv64gc as all having the
         | standard library functioning. Due to there not being official
         | builds, I'm guessing that there would either have to be an
         | officially maintained package to install or you'd have to build
         | it from scratch, though, but it seems likely that having a
         | functioning compiler already means that you wouldn't have to
         | fully bootstrap everything (and if you did, maybe it would be
         | possible to bootstrap from rustc?)
         | 
         | [1]: https://doc.rust-lang.org/nightly/rustc/platform-
         | support.htm...
        
           | nevi-me wrote:
           | I think the simpler answer is that regardless of platform,
           | gccrs can't yet compile core or std libraries, so println!
           | won't work (https://github.com/Rust-GCC/gccrs/issues/1389).
           | 
           | I don't think it's about what tier is supported in rustc, as
           | that's compiled by LLVM in that case.
        
       | scrame wrote:
       | This is the first I've heard of Objective-C++ [1]. What kind of
       | masochist would you have to be to pick that?
       | 
       | [1] https://en.wikipedia.org/wiki/Objective-C#Objective-C++
        
         | dagmx wrote:
         | It's really great when you need to call ObjC APIs from C++ or
         | vice versa.
         | 
         | For the most part you can keep things as regular C++ and then
         | just mix in some ObjC APIs when needed without splitting out
         | your files and targets.
         | 
         | It's extra useful because macOS provides a lot of really great
         | utility libraries like dealing with media or networking, which
         | means you can greatly reduce your dependency count on Apple
         | platforms.
         | 
         | I try and take the approach of reducing dependencies in favour
         | of platform native APIs where possible when making multi
         | platform code, and this is great for that.
         | 
         | Of course it means you have different details on each platform,
         | but I find it much more pleasant than having to keep building
         | dependencies, and dealing with all the corresponding issues
         | like security, size or dealing with platform specific
         | acceleration.
        
         | pjmlp wrote:
         | NeXT, as means to bring C++ software into NeXTSTEP.
        
         | arcticbull wrote:
         | Objective-C is a superset of C, and Objective-C++ extends that
         | to C++. It's really only meant as a shim layer to bridge C++
         | libraries with Objective-C. Or at least, that was the case in
         | the pre-Swift days.
        
         | jaas wrote:
         | The OS X platform code for Firefox is written in Objective-C++.
         | It's not without issues, but overall it's a nice way to use
         | Objective-C from within a larger C++ code base. I didn't find
         | it difficult to work with, particularly as opposed to what we'd
         | have to do if Objective-C++ didn't exist.
         | 
         | If you want to see what this looks like, look at the .mm files
         | here:
         | 
         | https://github.com/mozilla/gecko-dev/tree/master/widget/coco...
         | 
         | If you want a specific file to look at with good examples of
         | how this works, here's one:
         | 
         | https://github.com/mozilla/gecko-dev/blob/master/widget/coco...
         | 
         | Basically what you're looking for is being able to make Obj-C
         | calls (e.g. [[ChildView alloc] initWithFrame:r
         | geckoChild:this]) from within what is otherwise normal C++, and
         | vice-versa.
        
           | MBCook wrote:
           | Thanks! I remember hearing it existed long ago but I've never
           | heard of it being used. Great explanation.
        
         | fathyb wrote:
         | I did, mostly for Metal-based rendering. It's great if you want
         | to mix Apple's Objective-C APIs with your own C++ code.
        
           | pjmlp wrote:
           | Which is a much better solution than using the incomplete C++
           | bindings released earlier this year.
        
             | jxy wrote:
             | this? https://developer.apple.com/metal/cpp/
             | 
             | Doesn't it just use objc/runtime.h and if anything is
             | missing you can just add your custom api calls?
        
               | pjmlp wrote:
               | That is exactly it, the additional effort to add missing
               | calls, no Metal frameworks integration, it is mostly for
               | basic workloads.
        
       | chungy wrote:
       | Seems a nice way to bury a lede :) No links back to GCC including
       | the languages, and a look at https://gcc.gnu.org/ doesn't reveal
       | it either, even if you click on changes for GCC 13.
        
       ___________________________________________________________________
       (page generated 2022-12-19 23:00 UTC)