开发者

Is there a programming language that would have:

开发者 https://www.devze.com 2023-01-31 22:14 出处:网络
I am curious about such thing... Is there a programming language that would have: syntax such as Java and开发者_开发百科/or C++

I am curious about such thing... Is there a programming language that would have:

  • syntax such as Java and开发者_开发百科/or C++
  • templates/generics support
  • memory management (no garbage collection)
  • "clean syntax" (no mess like perl or c/c++)
  • "normal" OOP (polyphormism, interfaces, abstract classes, overloading and etc.)
  • (preferably) compiles to machine code
  • namespace support
  • exception support
  • no source preprocessor (as is in c\c++)
  • statically typed


Maybe ADA ? I can advice you to learn C/C++ or Java or something else and use it smartly - then you'll get everything you need.

UPD: You may be interested by D


  • syntax such as Java and/or C++
  • "clean syntax" (no mess like perl or c/c++)

So, basically you want syntax such as C++, but you don't want syntax such as C++. It should be obvious that such a language cannot possibly exist, since the intersection of the set of languages that have syntax such as C++ and the set of languages that do not have syntax such as C++ must necessarily be the empty set.

There also some other requirements that don't make sense, like this one:

  • (preferably) compiles to machine code

What the compiler produces as its output is a trait of the compiler, it has nothing to do with the language. Every language can be compiled to every other language, provided the target language has at least the same computational power as the source language. (Which typically means that the target language must be Turing-complete, since most source language are Turing-complete.)


What is your need for those features? Or are they things you think you need? Why not find a syntax you think you'll feel comfortable with, since that seems to be the most important thing in your list, and then explore your other application requirements


  • Vala - designed as unmanaged C# for gnome
  • D - Built on c but simpler than C++. I think it has some kind of GC though
  • The new versions of Delphi, doesn't have curly brace syntax though


I'm betting you'll have a hard time finding a language that meets all your criteria. However, these may be worth looking into:

  • Go. Clean syntax, compiles to machine code. Has GC, though. And isn't strictly O-O.
  • Scala addresses many, but not all, of your issues (as mentioned by others in this thread).
  • Haskell. Functional, not O-O. But worth looking at anyway.
  • D, also as mentioned by others.


It's definitely Scala. It confirms all your points


To put it bluntly: Learn C++ and use it the way it should be used.

Done.


You only get GC issues if you discard objects. Write your application to recycle object instead and you won't have any garbage collection.

You can design an application which only GC's over night for example. i.e. zero-cost during the day, but some garbage is allowed.

Perhaps you could say what your concern is with having a GC. There may be ways to work around the problem which opens up languages like C# and Java.

BTW: Java and C# is compiled to machine code at run time.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号