Jump to content

  • Log In with Google      Sign In   
  • Create Account

Just another thought (designing a fast but powerful language)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
77 replies to this topic

#1 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 17 February 2014 - 05:47 PM

I wanted to ask this in a previous thread but I thought it needed it's topic.
Would it be possible to make a compiled language as fast as c and c++, multi paradigm like c++, less complex than them both and can be used like in really complex situations like in making an OS/game engine/IDE etc.
Just wondering (may have mistakes above).

Thanks.


UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 13915

Like
6Likes
Like

Posted 17 February 2014 - 08:20 PM

Yes. I am sure proponents of go and D would claim their language fits the bill.

#3 jbadams   Senior Staff   -  Reputation: 19383

Like
3Likes
Like

Posted 18 February 2014 - 12:06 AM

Absolutely.

 

Whether or not any existing languages (such as the above-linked go and D) already meet most of those requirements is pretty subjective; we can obviously measure execution speed for code solving similar tasks, but what qualifies as "less complex" and what qualifies as "really complex situations" really depend on the skills and preferences of the programmer.

 

If you were thinking about starting such a project from scratch you should expect it to be very difficult, to take a lot of work, and to take quite some time to have anything workable; creating your own language (even if it's just a toy language) is however an excellent learning experience that's well worth undertaking at some point if you're interested in the low-level details of programming.

 

 

//EDIT: Please try to give your topics more meaningful titles; "Just another thought" tells a potential reader absolutely nothing about what they made find, so I've edited the title of this topic to be more descriptive.


Edited by jbadams, 18 February 2014 - 12:08 AM.
Added note re: topic titles.


#4 Nathan2222_old   Members   -  Reputation: -400

Like
1Likes
Like

Posted 18 February 2014 - 12:22 AM

//EDIT: Please try to give your topics more meaningful titles; "Just another thought" tells a potential reader absolutely nothing about what they made find, so I've edited the title of this topic to be more descriptive.


thanks for changing the title.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#5 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 12:46 AM

Java and D seem a lot like C++ (java involves more typing) and Go like C.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#6 SeanMiddleditch   Members   -  Reputation: 7192

Like
13Likes
Like

Posted 18 February 2014 - 01:19 AM

Java and D seem a lot like C++ (java involves more typing) and Go like C.

 

Please don't ever compare Java to C++ again.  It hurts me deep in my soul. :P



#7 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 01:27 AM

Java and D seem a lot like C++ (java involves more typing) and Go like C.

 
Please don't ever compare Java to C++ again.  It hurts me deep in my soul. :P
;)

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#8 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 02:21 AM

Absolutely.
 
Whether or not any existing languages (such as the above-linked go and D) already meet most of those requirements is pretty subjective; we can obviously measure execution speed for code solving similar tasks, but what qualifies as "less complex" and what qualifies as "really complex situations" really depend on the skills and preferences of the programmer.
 
If you were thinking about starting such a project from scratch you should expect it to be very difficult, to take a lot of work, and to take quite some time to have anything workable; creating your own language (even if it's just a toy language) is however an excellent learning experience that's well worth undertaking at some point if you're interested in the low-level details of programming.

i probably will undertake a project like this. I just feel like some things are more misunderstandable than they should be and there should be a better way.
Yersterday, i read an article saying that ruby/python programs involve 5x less lines than c and c++ programs. What does this mean?

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#9 Buster2000   Members   -  Reputation: 1776

Like
2Likes
Like

Posted 18 February 2014 - 02:23 AM

Of course it would be possible but weather or not it is feasible or even productive is another matter.



#10 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 02:47 AM

Of course it would be possible but weather or not it is feasible or even productive is another matter.

by reducing the number of lines required to do something.
Which is why i asked about what 5x less means (i don't want to misunderstand it).
For instance, gta iv contained about 50,000 which included lines and comments. What if the need for the comments (not all) where reduced because you could tell what a piece of code does by taking a glance at it (even by some beginners) and some extra code and extra typing will not be needed thereby enabling you do things faster, increasing productivity.
You *could* reduce the line count by more than 10,000 (maybe).

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#11 unbird   Crossbones+   -  Reputation: 6016

Like
0Likes
Like

Posted 18 February 2014 - 03:19 AM

Sure, the infamous LOC metric. Read here for a more recent thread about.



#12 fir   Members   -  Reputation: -456

Like
0Likes
Like

Posted 18 February 2014 - 03:21 AM

Yersterday, i read an article saying that ruby/python programs involve 5x less lines than c and c++ programs. What does this mean?

 

 

dont think so, I was not using python to much but this would

meen (if the function of your code will stay the same and they

if they doing something nontrivial but real code - stay the same)

that every of such function will be compressed  5X of 4X

- i dont see it - it will be about the same [esp if you will remove the blank lines and move code like

 

void f()           {

  if(a==0)        {

      b++;            } }

 

(years ago i was using thic convention, this is not so bad imo)

 

what else python make to short sources compared to c ?

(maybe something but it would be imo more like 20% shorter not 5X 


Edited by fir, 18 February 2014 - 03:27 AM.


#13 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 03:34 AM

Sure, the infamous LOC metric. Read here for a more recent thread about.

yes i have been seeing the lines of code stuff lately.
I personally don't use comments but as for whitespaces and newlines, they're everywhere.
If code isn't clear and readable, then it's not useful. How hard can it be to press spacebar or enter ? You don't really notice it while pressing.
What i want is a language that is easy to understand, make readable programs with as fast as possible (with less or more lines depending on the user) and can be used in many scenarios. I'ld rather write 50 lines of code with white space and without comments than 50 without whitespace and with comments everywhere.
I saw a program that had a total of about 784,000 LOC and about 264,000 were spaces while about 128,000 were comments so that leaves about less than 390,000 executable LOC. It's the 390,000 i'm focused on (if i wrote that program, it'll probably way more spaces).

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#14 Kirkkaf13   Members   -  Reputation: 301

Like
0Likes
Like

Posted 18 February 2014 - 06:00 AM

I would encourage you to have a look at some functional programming languages, SML, Haskell, Ocaml and Erlang.

I am by no means an expert in any of these languages but due to the high level design I find you can reduce your LOC dramatically.

I don't know how much these languages are suited for game programming or what tools are available but if you like a challenge and to expand your programming skills I highly recommend you delve into one.

#15 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 06:21 AM

I would encourage you to have a look at some functional programming languages, SML, Haskell, Ocaml and Erlang.
I am by no means an expert in any of these languages but due to the high level design I find you can reduce your LOC dramatically.
I don't know how much these languages are suited for game programming or what tools are available but if you like a challenge and to expand your programming skills I highly recommend you delve into one.

I've only heard of haskell.
I'm going to be learning assembly later on.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#16 LennyLen   Crossbones+   -  Reputation: 4024

Like
0Likes
Like

Posted 18 February 2014 - 06:47 AM


I am by no means an expert in any of these languages but due to the high level design I find you can reduce your LOC dramatically.

 

It depends on what you're doing.  If you're trying to perform mathematical expressions on a list of numbers, a functional language will most likely beat a procedural language hands down (in terms of LOC).  I'd hate to try to write an advanced application moreless verbosely though, as it's just not what they're designed for.


Edited by LennyLen, 18 February 2014 - 06:48 AM.


#17 Bacterius   Crossbones+   -  Reputation: 9287

Like
1Likes
Like

Posted 18 February 2014 - 06:51 AM

 

Yersterday, i read an article saying that ruby/python programs involve 5x less lines than c and c++ programs. What does this mean?

 

 

dont think so, I was not using python to much but this would

meen (if the function of your code will stay the same and they

if they doing something nontrivial but real code - stay the same)

that every of such function will be compressed  5X of 4X

- i dont see it - it will be about the same [esp if you will remove the blank lines and move code like

 

void f()           {

  if(a==0)        {

      b++;            } }

 

(years ago i was using thic convention, this is not so bad imo)

 

what else python make to short sources compared to c ?

(maybe something but it would be imo more like 20% shorter not 5X 

 

 

You do realize that when we say that Python code is shorter than e.g. C code we're not talking about removing the curly braces and a few comments, right? We're talking about the high-level structure of the code - Python is typically more expressive in less code, because it has a lot of stuff built-in (and cross-platform, for the most part), it's designed for short and concise syntax so that you don't have to implement all the stuff you need manually or use an external library (if even possible, like syntactic sugar).

 


(if the function of your code will stay the same and they
if they doing something nontrivial but real code - stay the same

 

That's the point - the code doesn't stay the same. It becomes shorter as a lot of the low-level complexity you have to deal with in C or C++ for instance is handled by the language and the runtime itself. Functions disappear because they become built-in, paragraphs of code become shorter because you don't need many lines to declare, initialize and populate a dictionary (key-value store) from a file, you can do it in one, you don't need to formally define complex object relations and dependencies since you have duck typing, variables are automatically freed, nontrivial command-line parsing is built-in and you don't have to go dig up a library on the internet and learn how to use it (more or less everyone uses argparse), big integers are built-in, you can even run Python code dynamically from existing code, etc, etc...

 

If you think Python is just C minus the curly braces then you clearly have never used it. It has its failings and doesn't work for everything (writing a large business application would probably get messy, and it has its warts) but when you use it - or Ruby, by the way, everything I said above almost certainly applies to Ruby even though I've never used it - for what it's meant for, the resulting code is surprisingly short and fluent.


The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#18 Nathan2222_old   Members   -  Reputation: -400

Like
0Likes
Like

Posted 18 February 2014 - 07:02 AM

dont think so, I was not using python to much but this would
meen (if the function of your code will stay the same and they
if they doing something nontrivial but real code - stay the same)
that every of such function will be compressed 5X of 4X
- i dont see it - it will be about the same [esp if you will remove the blank lines and move code like

void f() {
if(a==0) {
b++; } }

(years ago i was using thic convention, this is not so bad imo)

what else python make to short sources compared to c ?
(maybe something but it would be imo more like 20% shorter not 5X


You do realize that when we say that Python code is shorter than e.g. C code we're not talking about removing the curly braces and a few comments, right? We're talking about the high-level structure of the code - Python is typically more expressive in less code, because it has a lot of stuff built-in (and cross-platform, for the most part), it's designed for short and concise syntax so that you don't have to implement all the stuff you need manually or use an external library (if even possible, like syntactic sugar).

(if the function of your code will stay the same and they
if they doing something nontrivial but real code - stay the same


That's the point - the code doesn't stay the same. It becomes shorter as a lot of the low-level complexity you have to deal with in C or C++ for instance is handled by the language and the runtime itself. Functions disappear because they become built-in, paragraphs of code become shorter because you don't need many lines to declare, initialize and populate a dictionary . . .
that's what i mean. It's not the whitespace, it is just, shorter.
What do you mean by functions disappear etc.?

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#19 Nathan2222_old   Members   -  Reputation: -400

Like
-4Likes
Like

Posted 18 February 2014 - 07:09 AM

After reading the wikipedia article on functional programming, i see that that's where c++ got recursivity from and functional programming seems to be concerned with only mathematics.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#20 LennyLen   Crossbones+   -  Reputation: 4024

Like
1Likes
Like

Posted 18 February 2014 - 07:18 AM


What do you mean by functions disappear etc.?

 

Imagine I had the following function in C++:



bool SomeElementIsTrue(std::vector<bool> vec) {

    for(std::vector<bool>::iterator it = vec.begin() ; it != vec.end(); ++it)
        if (*it == true)  return true;

    return false;

}

If I converted my program to Python, I can remove the entire function, and use the built-in 'any' function. 


Edited by LennyLen, 18 February 2014 - 10:01 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS