TOPIC: Suneido and other Dynamic Languages
#811
Suneido and other Dynamic Languages 3 Years, 5 Months ago
As a long time Delphi programmer I am very comfortable with a statically compiled language system. I have read a lot the Suneido User Manual and this website which includes this quote:

We needed a simple, easy to learn, powerful language that was dynamic, like Lisp or Smalltalk, but had a familiar syntax like C++ or Java

But what I am wondering is this:

* Is there a book or something that can bring a programmer (like me) without a background in Lisp or Smalltalk up to speed with a different way of thinking when programming in a dynamic language (like Suneido)?

I ask this because while I am making progress with Suneido, I have a suspicion that without thinking differently all my Suneido code is going to be like Delphi code with Suneido syntax. And by doing that I will be missing out on the benefits of the dynamic/scripting nature of the Suneido language.

Of course any tutorial for another language will be of no help with Suneido syntax, I understand that, but am interested in a tutorial/book/resource that introduces a different way of thinking about problem solving.

I hope this makes sense and any suggested references are most welcome.
 
 
Scotty
 
#814
Re:Suneido and other Dynamic Languages 3 Years, 5 Months ago
Hi, I don't think you have to think much different, to code in Suneido language. The main difference is that, generally, in Suneido is all simpler. You don't have to declare variables before you use them (and you cannot mistake, because Suneido doesn't allow predeclarations of variables).
Of course, you have to learn a new syntax (and this is especially true for a Delphi programmer) and if you have to write much object-oriented code (i.e. you have to implement many classes), you should first to learn well how classes and objects work in Suneido. For example, in Suneido all classes derives from the Object built-in class, so, for each class you implement, you can use all the Object class standard methods (described in 'Language -> Reference -> Object' section of the User's Manual).

Can you make me a more specific example of your problems?
 
 
Mauro
 
#817
Re:Suneido and other Dynamic Languages 3 Years, 5 Months ago
Hi, perhaps I don't have to think differently, but I will try to explain further what I mean.

For example, when moving from plain procedural Pascal to Object Pascal (Delphi) a programming shift is made to use an object oriented approach where thinking is less in terms of libraries with functions, but instead more of a hierarchy of classes.

Similarly being a dynamically language that is interpreted/compiled at run time, there are features like:

* Evaluating strings as Suneido code at run-time.

* Blocks

* I think you can define and change the methods of classes at run-time (not just polymorphism)

These are interesting abilities that a statically compiled language like Pascal/Delphi doesn't have.


So far, from my adventures with Suneido, I get the feeling that features like those listed above contribute to making the Suneido language and it's environment so elegant and compact.

What I am saying is that thinking differently when going from:

Procedural Code ---> Object Oriented Code

means some cases of problem can be written more easily, similarly when going from:

Statically Compiled Code ---> Dynamic Scripted Language

(I guess) you can solve some problems more efficiently by thinking outside of the old ways with static compilation. (At this stage I don't have a particular problem to solve.)


Certainly, I could use Suneido as a way of defining and using classes in the same way as I have done before in Delphi to write business applications.

But on another level, I suspect that by thinking differently from before, there is even more power to unleash.

And just as I found moving from Procedural Code to Object Oriented Code was assisted by reading some books that were not necessarily about Delphi but about OOP in a more general way, now I am wondering if the move to a dynamically scripted environment could be assisted by some background reading.

I have found the User Manual and examining the stdlib very illuminating, but I was hoping to get a higher level view and understanding of some of the techniques that are possible with languages like Suneido.

Thanks for taking to the time to read this reply, and I hope I have explained what I am trying to say a bit better.

Post edited by: smpcs, at: 2007/03/19 04:00
 
 
Scotty
 
#818
Re:Suneido and other Dynamic Languages 3 Years, 5 Months ago
In the above post, when I said:

* I think you can define and change the methods of classes at run-time (not just polymorphism)


I really meant:

* I think you can define and change the members in the instance of a class at run-time.
 
 
Scotty
 
#819
Re:Suneido and other Dynamic Languages 3 Years, 5 Months ago
Hi, I think that an ideal language should be as simpler as possible for its user (in respect to its needs). If the language requires that you have to think in a complicated way to use it well, then I think this language is very far from that ideal language.

In Suneido, you cannot create new methods at run-time, but there are some tricks to 'simulate' new methods at run-time. I have used those tricks to implement a multiple-inheritance pattern (see this discussion if you are interested), but they are not mean to be used for daily coding. By the way, after much thinking on multiple-inheritance, I concluded that are very few the cases in which you would want a multiple-inheritance feature in your preferred language. It's not a coincidence that languages as Java or C# doesn't support it natively.

In my opinion you should think at your code as simple as possible, of course in an object-oriented way would be better, but in a simple way. Why should I create a new method at run-time? In the 99% of the situations, this is not needed, then why should I be bothered with it? I think there is always a simpler way.

Finally I don't think that dynamically typed languages are always better than statically typed languages. With statically typed languages the compiler can prevent many errors at compile-time that with dynamically typed languages you can discover only at run-time. It's always a trade-off between the desired features. It's for this that it doesn't exists the perfect programming language suited for all the needs.

Sorry but I don't know if there are books about dynamically typed languages not related to a specific language.
 
 
Last Edit: 2008/02/20 17:45 By sunadmin. Reason: update forum link
 
Mauro
 
#822
Re:Suneido and other Dynamic Languages 3 Years, 5 Months ago
Hi Mauro,

I think that an ideal language should be as simpler as possible for its user

You are certainly right there. That is one of the reasons why I like Pascal/Delphi so much. Single inheritance and an object and visual component model that is very straightforward. The Pascal syntax is clean and unambiguous.

And so while getting used to the Suneido syntax takes a little time, it appears to be logical most times.

About creating a new method at run-time you are right to say why bother and there is almost always an easier way is true. I probably wasn't thinking of doing that often, but just the fact that it is possible is interesting.

Similarly, the Eval string methods may not be used often in regular code, but just the fact that it is possible to evaluate a string as code which is something that can't be done in Delphi (well, it can be done with a component like the one here: www.dwscript.com/ ) and to have that ability built into the language intrigues me.

So while I agree with your keep is simple approach, I want to keep my mind open to the possibilities of the Suneido language which may allow approaches that weren't easily possible before.

Sorry but I don't know if there are books about dynamically typed languages not related to a specific language.

It looks like I'll be reading up on Smalltalk in the absence of a generic book.

Post edited by: smpcs, at: 2007/03/20 02:17
 
 
Scotty