OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 24, 2020 5:32 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: New programming language
PostPosted: Wed Jul 30, 2014 5:33 am 
Offline
Member
Member

Joined: Tue Nov 09, 2010 12:03 pm
Posts: 27
Hi ;)

Making a fork of this topic, I want to show a new programming language... not so new, but, new, for windows....

ELENA is a general-purpose, full object-oriented, polymorphic language with late binding. It promotes more object-oriented program design, reusable and more standardized code.

The language features code mutation, ElenaScript, argument signatures and many others. It is under active development!

Features
[*]Pure polymorphic object oriented language
[*]Changeable object behavior
[*]Dynamic class mutation
[*]Command line 32-bit compiler
[*]GUI IDE & Debugger
[*]Unicode support
[*]Complete source code
[*]Getting started tutorial
[*]Simple Assembler compiler
[*]Multiple message dispatch
[*]Virtual Machine Terminal
[*]Dynamic Self-Assembling Script engine

You can download the compiler and source code in this link: http://sourceforge.net/projects/elenalang/ .or. in this: https://github.com/ELENA-LANG/elena-lang

Here a simple sample: ( hello world )
Code:
// --- Program ---

#symbol Program =
[
    system'console writeLine:"Hello World!!" readChar. // wait for any key
].


And a class sample ( Class to help in read and write a .INI file ):
Code:
#class IniHelper
{
   #field fileName.

    #constructor new &FileName:cFileName
    [
        fileName := cFileName.
    ]   
   
    #method SetFileName : cFileName
          [ fileName := cFileName. ]
   
    #method IniReadValue &section:cSection &key:cKey
    [
        #var retValue := LiteralValue new &length:255.
        #var bufRet := Integer new.
        bufRet << system'external'KERNEL32 GetPrivateProfileStringW
                 &literal:cSection
                  &literal:cKey
                   &literal:0
                  &out'literal:retValue
                  &int:255
                  &literal:fileName.
             
        ^(retValue delete &index:bufRet &length:(255-bufRet)).
    ]
   
    #method IniWriteValue &section:cSection &key:cKey &value:cValue
    [
        #var(type:int) lRet := system'external'KERNEL32 WritePrivateProfileStringW
                          &literal:cSection
                            &literal:cKey
                           &literal:cValue
                            &literal:fileName.
        (0 == lRet)
           ? [ #throw Exception new:"Impossible to create the file". ].
    ]
}


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Wed Jul 30, 2014 2:35 pm 
Offline
Member
Member

Joined: Tue Nov 08, 2011 11:35 am
Posts: 453
Hm... this style looks familiar. Ah, here it was: https://en.wikipedia.org/wiki/Julia_language


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Wed Jul 30, 2014 5:12 pm 
Offline
Member
Member

Joined: Tue Nov 09, 2010 12:03 pm
Posts: 27
Oh!!

haha,yes, really like... btw, Elena is based on SmallTalk!


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Thu Aug 21, 2014 5:20 pm 
Offline
Member
Member
User avatar

Joined: Wed Jul 30, 2014 1:05 am
Posts: 153
As much as I admire the fact that you were able to create your own programming language and write a compiler for it, this language just gives me a headache. Pointing out the problems I see with it:


  • The use of hashtag symbols in declarations. There is no reason for these to be there. The keywords should already be reserved, so all it does is make the code illegible, and can be a source of confusion for people coming from C++ or Python backgrounds where it is used for comments or pragma directives

  • The use of '.' to mark the end of lines of code. Yes, I understand there are languages that use this, but most of those languages have pretty much died. This would be a source of trouble for anyone coming from a background of most other modern languages where a semi-colon is pretty much the adopted standard and periods are used for referencing.

  • Symbol declaration just looks ridiculous. Program = [ print "hello world" ]; wtf?! That makes no sense. Executable code shouldn't be treated like a variable.

  • This:
    Code:
    ^(retValue delete &index:bufRet &length:(255-bufRet)).
    Firstly, I'm not even sure if you're using the ampersand as some way of referencing the address of an object or if it's supposed to be an object prefix like $ in PHP because of how much it populates the code. Second, deleting something shouldn't return a value. Third, why are you using something like ^ to return a value from a function instead of using a keyword like "return"?

  • Using ' for what I assume can only be either name-spacing or applying attributes is also ridiculously confusing. Why is it only used once in some areas and twice in others? Anyone coming from any other language would probably just stare at this for a few minutes drooling on their keyboard.


There are some decent ideas that I can see like using ":=" to assign variables instead of "=" which rids the confusion between "=" and "==" for beginners, and what appears to be the use of interfaces for methods, but for the most part it's an eyesore. While it is good to introduce new things, you must also take into consideration what most people are already familiar with.

It seems like you didn't put any time whatsoever into studying the pros and cons of various languages, reading a few articles or threads about programming language design theory to see what other features people might desire for in a language, nor taking a look at some statistics to get a general oversight on what people are most content with. If it's something you made specifically for yourself, then I guess the phrase is "whatever floats your boat...", but as it stands I cannot see any sane non-masochistic person who would look at these examples and say; "oh! I wanna learn that!".


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 12:14 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3751
Location: Chichester, UK
Most, if not all, of the features that you object to are taken from Smalltalk, which the OP said his language is based on. This is by no means an unknown, unused language. You might as well complain that:

[obect doSomething]

is not a good way to call a method because that's not the way that C++ does it.

I think your response demonstrates your unfamiliarity with languages other than the C type ones. I'm sure there are valid reasons for writing your own vaiant of C (just as there ave valid reasons for writing anothe Unix clone), but let's not limit people's imagination to the immediately familiar.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 3:54 am 
Offline
Member
Member

Joined: Tue Nov 08, 2011 11:35 am
Posts: 453
DaemonR wrote:
Executable code shouldn't be treated like a variable.
Oh, you made me laugh. Sorry but there are a lot of interesting and useful languages (and ideas behind them) besides C&Java family.
https://en.wikipedia.org/wiki/Von_Neumann_architecture
https://en.wikipedia.org/wiki/Homoiconic
https://en.wikipedia.org/wiki/Anonymous_function
tl;dr:
1. Code is just one kind of data with it's special set of interpretation rules.
2. It easier to think that by default all functions are anonymous (i.e. defined as lambdas) and name of function is just a variable that holds address of/reference to code.
3. We can extend this idea and use references not only to functions but also to program modules.
Btw, you can see all these things in Python, that is quite popular language.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 4:51 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3751
Location: Chichester, UK
Even C can treat executable code like a variable. Pointers to functions are not that uncommon.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:05 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 30, 2014 1:05 am
Posts: 153
Function pointers and assigning executable code to a symbol like you'd assign a value to a variable are two completely different things.

Code:
#symbol Program = [ code ]

Is just ridiculous and inconsistent when you can do

Code:
#method Program [ code ]

Inconsistency is yet another reason people wouldn't want to learn something. If it were something more like:

Code:
#symbol Program = MyClass:Program

It would be more understandable.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:14 am 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1010
DaemonR wrote:
Inconsistency is yet another reason people wouldn't want to learn something.


Like a foreign/spoken language. :) And yet they do. :)


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:19 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 30, 2014 1:05 am
Posts: 153
alexfru wrote:
DaemonR wrote:
Inconsistency is yet another reason people wouldn't want to learn something.


Like a foreign/spoken language. :) And yet they do. :)



The reasons why you learn a spoken language and why you learn a programming language are completely different. You learn a spoken language to communicate with people, you learn a programming language because it's practical or for learning experience.

Edit:
Regardless, it even deters people from learning spoken languages. Eg. A lot of people give up on learning Mandarin because the same words can have entirely different meanings just by slight differences in intonation.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:28 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3751
Location: Chichester, UK
Quote:
Function pointers and assigning executable code to a symbol like you'd assign a value to a variable are two completely different things.

So what else is happening when you assign a function pointer to a variable?


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:31 am 
Offline

Joined: Fri Aug 22, 2014 2:00 am
Posts: 1
DaemonR wrote:
Function pointers and assigning executable code to a symbol like you'd assign a value to a variable are two completely different things.

Code:
#symbol Program = [ code ]

Is just ridiculous and inconsistent when you can do

Code:
#method Program [ code ]

Inconsistency is yet another reason people wouldn't want to learn something.


Code:
#symbol Program = [ code ]

is just a short form of
Code:
#symbol Program = { evaluate [ code ] }.  // where "evaluate" is a method name

which is a short form of
Code:
#class ProgramClass
{
   #method evaluate [ code ]
}

#symbol Program = ProgramClass new.


And of course it was inspired by Smalltalk as well.


Last edited by arakov on Fri Aug 22, 2014 8:34 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:33 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3751
Location: Chichester, UK
I learn computer languages so I can communicate with computers.

Your example of Mandrin is a poor choice. Despite your reason why people wouldn't want to learn it, more people speak it than any other language.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:42 am 
Offline
Member
Member
User avatar

Joined: Wed Jul 30, 2014 1:05 am
Posts: 153
When you are assigning a function to a function pointer, the code still remains referenced when the pointer changes.

Code:
void fn() { }
void diffFn() { }

void (*fnPtr)() = (void (*)()) fn;

fnPtr = (void (*)()) diffFn;

Look at what happens now:

Code:
#symbol Program = [ code ]
Program = [ diffCode ]

The old code doesn't just disappear, it's still there, but there are no references to it whatsoever. And what about passing arguments? And if you can't re-assign the symbol Program, then what reason is there to use #symbol instead of #method?


@iansjack, more people don't speak the language because they like it, they speak it because it's the native language of many of the world's heaviest populated countries. Right now, people are actually pushing for changes in how their own language is spoken and written because even they have trouble with it.


Top
 Profile  
 
 Post subject: Re: New programming language
PostPosted: Fri Aug 22, 2014 8:52 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3751
Location: Chichester, UK
Quote:
The old code doesn't just disappear

Well, in Smalltalk that's exactly what happens. As there is no reference to it the garbage collector will free the memory. This doesn't happen in C because there is no garbage collection. But what is happening under the hood is irrelevant; you are still assigning code to a variable when you use variables of type function pointer.

You are quite correct about Mandrin - people learn languages for all sort of reasons, and the fact that the language may be inconsistent doesn't stop them. It's difficult to think of any languages, human or computer, that don't have their share of inconsitencies.

I think you need to open your mind a little to programming paradigms other than C-like languages. A good starter would be to learn Smalltalk.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: ComputerFido and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group