www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Dynamic language

reply "so" <so so.so> writes:
Hello,

Not related to D but this is a community which i can find at 
least a few objective person. I want to invest some "quality" 
time on a dynamic language but i am not sure which one. Would you 
please suggest one?

To give you an idea what i am after:
Of all one-liners i have heard only one gets me.
"The programmable programming language". Is it true? If so Lisp 
will be my first choice.

Thanks.
Mar 15 2012
next sibling parent reply "F i L" <witte2008 gmail.com> writes:
On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 Hello,

 Not related to D but this is a community which i can find at 
 least a few objective person. I want to invest some "quality" 
 time on a dynamic language but i am not sure which one. Would 
 you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp 
 will be my first choice.

 Thanks.

Not really a help to you, but I honestly have no idea why people *want* to use dynamic programming languages. There is very little benefit I see in having your core object structure be complete dynamic. I remember watching this Google tech talk awhile ago, about V8 and improving Javascript performance. At one point, the speaker talks about how cool Dynamic objects *can* be, but then goes on later to say that 90% of code isn't structured that way (and thus justifying V8's JITed hidden classes). I think a language should be static first and dynamic second. C# does this nicely (anonymous and dynamic types, Link, etc) and I think D is at least partially there (in regards to dynamic objects) with std.variant + associative arrays.
Mar 15 2012
next sibling parent "Paulo Pinto" <pjmlp progtools.org> writes:
I have for three years worked in a web platform somehow similar to Ruby on
Rails, but TCL based, actually it was a kind of AOL Server clone.

The main benefit dynamic languages bring to the table is not requiring to
write types everywhere, duck typing, and the flexibility metaprogramming
has.

For example in our server, the ORM was able to do translations on the fly 
from
SQL 92' to the DB specific SQL, and also map classes and properties to 
tables
and columns on the fly. So adding new DB backends was quite easy.

Now that mainstream strong typing static languages are getting type 
inference,
a solution similar to std.variant or .NET dynamic, might just be the sweet 
spot
of both worlds. As you are stating.

--
Paulo



"F i L"  wrote in message news:hakctekpvjnkyjhxacoo forum.dlang.org...

On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 Hello,

 Not related to D but this is a community which i can find at least a few 
 objective person. I want to invest some "quality" time on a dynamic 
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be my 
 first choice.

 Thanks.

Not really a help to you, but I honestly have no idea why people *want* to use dynamic programming languages. There is very little benefit I see in having your core object structure be complete dynamic. I remember watching this Google tech talk awhile ago, about V8 and improving Javascript performance. At one point, the speaker talks about how cool Dynamic objects *can* be, but then goes on later to say that 90% of code isn't structured that way (and thus justifying V8's JITed hidden classes). I think a language should be static first and dynamic second. C# does this nicely (anonymous and dynamic types, Link, etc) and I think D is at least partially there (in regards to dynamic objects) with std.variant + associative arrays.
Mar 15 2012
prev sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 3/15/12 3:58 AM, F i L wrote:
 Not really a help to you, but I honestly have no idea why people *want*
 to use dynamic programming languages. There is very little benefit I see
 in having your core object structure be complete dynamic. I remember
 watching this Google tech talk awhile ago, about V8 and improving
 Javascript performance. At one point, the speaker talks about how cool
 Dynamic objects *can* be, but then goes on later to say that 90% of code
 isn't structured that way (and thus justifying V8's JITed hidden classes).

 I think a language should be static first and dynamic second. C# does
 this nicely (anonymous and dynamic types, Link, etc) and I think D is at
 least partially there (in regards to dynamic objects) with std.variant +
 associative arrays.

Relevant insight: http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/ Andrei
Mar 15 2012
prev sibling next sibling parent "Paulo Pinto" <pjmlp progtools.org> writes:
I would advise Python. The only drawback it has, among dynamic languages
is that you need to be happy to work with forced indentation, which is not
a big issue, as long as you use a Python aware editor.

This is just a personal taste, feel free to choose another one if it better 
suits
your use cases.

--
Paulo


"so"  wrote in message news:uamqdkmnshxmvayeumbz forum.dlang.org...

Hello,

Not related to D but this is a community which i can find at
least a few objective person. I want to invest some "quality"
time on a dynamic language but i am not sure which one. Would you
please suggest one?

To give you an idea what i am after:
Of all one-liners i have heard only one gets me.
"The programmable programming language". Is it true? If so Lisp
will be my first choice.

Thanks. 
Mar 15 2012
prev sibling next sibling parent bls <bizprac orange.fr> writes:
On 03/15/2012 12:09 AM, so wrote:
 Hello,

 Not related to D but this is a community which i can find at least a few
 objective person. I want to invest some "quality" time on a dynamic
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be
 my first choice.

 Thanks.

Why not having both D and Lisp (embedded). Have a look at newLisp at http://www.newlisp.org Quote newLISP can be compiled as a shared library. On Linux, BSDs and other Unix flavors the library is called newlisp.so. On Windows it is called newlisp.dll and newlisp.dylib on Mac OS X. A newLISP shared library is used like any other shared library. The main function to import is newlispEvalStr. Like eval-string, this function takes a string containing a newLISP expression and stores the result in a string address. The result can be retrieved using get-string. The returned string is formatted like output from a command-line session. It contains terminating line-feed characters, but but not the prompt string. End Quote Would be interesting to implement a toSExpression() template than ... :)
Mar 13 2012
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2012-03-15 08:09, so wrote:
 Hello,

 Not related to D but this is a community which i can find at least a few
 objective person. I want to invest some "quality" time on a dynamic
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be
 my first choice.

 Thanks.

If I use a dynamically typed language I always choose Ruby, if I have that option. -- /Jacob Carlborg
Mar 15 2012
prev sibling next sibling parent Michal Minich <michal.minich gmail.com> writes:
http://rigaux.org/language-study/scripting-language/
Mar 15 2012
prev sibling next sibling parent Ary Manzana <ary esperanto.org.ar> writes:
On 3/15/12 4:09 AM, so wrote:
 Hello,

 Not related to D but this is a community which i can find at least a few
 objective person. I want to invest some "quality" time on a dynamic
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be
 my first choice.

 Thanks.

I suggest Ruby. You can practically change everything in the language and use metaprogramming. With Ruby you don't have to fight with the compiler (or interpreter). You feel free and have fun. Plus the standard library has lots and lots of methods you definitely will use and won't have to write from scratch.
Mar 15 2012
prev sibling next sibling parent "Jesse Phillips" <jessekphillips+D gmail.com> writes:
On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 Hello,

 Not related to D but this is a community which i can find at 
 least a few objective person. I want to invest some "quality" 
 time on a dynamic language but i am not sure which one. Would 
 you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp 
 will be my first choice.

 Thanks.

I'm not sure if it is subjective, but I think Lua would be a good one. Not because it is a great language. But is a simple language that embeds easily (LuaD). I use D for scripting so I don't really have much suggestion on the Python/Ruby front. But bash is somewhat useful.
Mar 15 2012
prev sibling next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Mar 15, 2012 at 03:27:32PM +0100, Jesse Phillips wrote:
 On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
Hello,

Not related to D but this is a community which i can find at least
a few objective person. I want to invest some "quality" time on a
dynamic language but i am not sure which one. Would you please
suggest one?


 I use D for scripting so I don't really have much suggestion on the
 Python/Ruby front. But bash is somewhat useful.

Bash?? Are you serious?! OK, I'll admit that bash is a very useful shell and has quite advanced scripting abilities... I mean, I use bash everyday myself, but as a *dynamic language*, bash scripting is simply atrocious. Its over-zealous interpolation of everything it sees, often multiple times, is one such atrocity (from the POV of a dynamic *programming* language; I'm not questioning its usefulness in the context of *shell scripting*). This makes it nigh impossible to pass certain strings around to script functions without the shell eating some escape characters and breaking everything. You pretty much have to save everything in what amounts to global variables to prevent this, and even then every time you read/write to the variables interpolation takes place. So it's leaning-toothpick syndrome everywhere. The shell's philosophy of having minimal functionality in the actual shell itself and delegating pretty much all complex functionality to external programs is ... useful from a shell scripting POV, but extremely inefficient from a programming POV. I always remember my first job, where a colleague was having trouble with a shell script that generated some reports required by the customer, because it was taking too long to run. When they called on me to help, I found that about 99% of the time was spent forking and exec'ing subprograms (with the associated I/O delays and whatnot). I rewrote the script in Perl, and the running time was reduced from more than 2 *days* to less than 2 minutes. If I were to recommend a dynamic *programming* language, it would be anything *but* bash! T -- "Holy war is an oxymoron." -- Lazarus Long
Mar 15 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 I want to invest some "quality" time on a dynamic language but 
 i am not sure which one. Would you please suggest one?

D! I'm not kidding... let's look at a list of things you might want: * You mentioned lisp. One of the cooler things there are macros. (And I like the syntax too. It is weird, but elegant.) You can go hog wild with lisp macros, generating all kinds of new things. In D, you can do similar metaprogramming with templates and mixins. The syntax is different, of course, but you can do much of the same stuff. * Modifying builtin types and methods. In D, you can achieve this with classes, UFCS, or alias this. Javascript might do: String.prototype.awesome = function() { return this.toUpperCase(); } Then, you can call it like so: "cool".awesome(); // returns "COOL" In D, of course, you can just write: string awesome(string s) { return toUpper(s); } "cool".awesome(); // returns "COOL" The newest dmd extends this to more types than just arrays. What about an integer that subtracts instead of adds? struct Int { int payload; alias payload this; this(int a) { payload = a; } Int opBinary(string op : "+")(int rhs) { return Int(payload - rhs); } } Now use Int instead of int in your code: void main() { Int a = 10; assert(a + 5 == 5); } and you can pass it to things that expect int, though you won't get the magic behavior there. * You might want to replace methods on a function that doesn't expect it. This is where we substitute our behavior in code that doesn't expect it at all... and that's exactly what class method overriding does. * You want to get properties or behavior from some outside source. This is where you might use something like Variant, or string conversions depending on how you got the data. Javascript: var a = JSON.parse("[1,2,3]"); assert(a[0] == 1); // pretend js has assert... D: auto a = JSON.parse("[1,2,3]"); // see Robert Jacques std.json and std.variant, though the version I have doesn't compile right with new phobos, it can be fixed assert(a[0] == 1); * You want to build objects and properties on the fly. Javascript: var a = {}; a.sweet = 10; a.cool = function() { this.sweet++; } a.cool(); assert(a.sweet == 11); D: import std.variant; struct Extendable { Variant[string] properties; Variant opDispatch(string name)() { return properties[name]; } Variant opDispatch(string name, T)(T t) { properties[name] = t; return properties[name]; } } void main() { auto a = Extendable(); a.sweet = 10; a.cool = { a.sweet = a.sweet + 1; } // could probably fix ++ too.. // fails with std.variant but the language *could* do it a.cool(); // exercise for the reader: maek this work! Gotta add opCall. } But, yeah, you can seriously use D to explore dynamic programming as well as programmable programming languages if you want to. It checks most the big boxes.
Mar 15 2012
parent "Nick Sabalausky" <a a.a> writes:
"Adam D. Ruppe" <destructionator gmail.com> wrote in message 
news:bighgnfjujyisywpceqt forum.dlang.org...
 import std.variant;
 struct Extendable {
     Variant[string] properties;
     Variant opDispatch(string name)() {
        return properties[name];
     }
     Variant opDispatch(string name, T)(T t) {
        properties[name] = t;
        return properties[name];
     }
 }

 void main() {
     auto a = Extendable();
     a.sweet = 10;
     a.cool = { a.sweet = a.sweet + 1; } // could probably fix ++ too..
     // fails with std.variant but the language *could* do it
     a.cool(); // exercise for the reader: maek this work! Gotta add 
 opCall.
 }

I'm compelled to make a slight tweak to that: import std.variant; struct Extendable { Variant[string] properties; Variant opDispatch(string name)() { return properties[name]; } Variant opDispatch(string name, T)(T t) { properties[name] = t; return properties[name]; } // Tweak Start void crystal() { this.wild = true; this.sweet = true; this.cool = true; } // Tweak End }
Mar 15 2012
prev sibling next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 If so Lisp will be my first choice.

I just talked about D because D rox, but if you are doing it for education, Lisp is a good choice because it is fairly unique. For real jobs, I'd go with D or maybe Javascript if I wanted scripting. (Javascript isn't a great language, but it is good enough, well supported, and popular; people can pick it up and go pretty easily. I've previously used Lisp for scripting - you can make a Lisp interpreter in ~1,000 lines of code - but JS has decent interpreters out there too.) But for education, Lisp's uniqueness is a good thing - experiencing the new syntax and playing with the macros is a good way to learn things you might have not looked at otherwise. So I'll second Lisp if you don't want to play with D.
Mar 15 2012
parent reply "Nick Sabalausky" <a a.a> writes:
"so" <so so.so> wrote in message 
news:rxuivgogjashzlkeeknx forum.dlang.org...
 Thank you all!

 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:
 On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 If so Lisp will be my first choice.

I just talked about D because D rox, but if you are doing it for education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I've often thought about it. What you would do is compile & load the "script" sections as dynamic libraries. Then, even the game engine itself could just invoke the command-line statement to compile the "script" to a dynamic library, and then reload the new dynamic library. Quake 2 used DLLs instead of a "scripting" language. As for other langauges: Lua is currently *king* for game scripting. It's used all over the gaming industry because it's fast and integrates with C very easily. Personally, I don't like it because it *is* a dynamic langauge. But if you're looking for a dynamic language, well, then there's that. Back in the 90's, the game Abuse famously had all its gameplay code written in LISP. It's been open-sourced, so you can can find the source and look through it.
Mar 15 2012
parent reply "Nick Sabalausky" <a a.a> writes:
"so" <so so.so> wrote in message 
news:pwaqudgwudpbcfibihhg forum.dlang.org...
 On Thursday, 15 March 2012 at 19:35:15 UTC, Nick Sabalausky wrote:

 As for other langauges:

 Lua is currently *king* for game scripting. It's used all over the gaming
 industry because it's fast and integrates with C very easily. Personally, 
 I
 don't like it because it *is* a dynamic langauge. But if you're looking 
 for
 a dynamic language, well, then there's that.

Not just because i am looking for, how would you code a customizable ui (wow ui for example) without an interpreter? You got no other options AFAIK when it comes to customizable stuff.

Anything an interpreter can do, a compiler can do. And dynamic typing doesn't have anything to do with interpreted vs compiled anyway.
Mar 15 2012
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 3/15/12 3:12 PM, Nick Sabalausky wrote:
 Anything an interpreter can do, a compiler can do. And dynamic typing
 doesn't have anything to do with interpreted vs compiled anyway.

Generating and running code during runtime is often easier in interpreted environments. Andrei
Mar 15 2012
parent "Paulo Pinto" <pjmlp progtools.org> writes:
That is the reason why managed environments with JIT are so popular,
you get the best of both worlds.

"Andrei Alexandrescu"  wrote in message 
news:jjtiu8$1ucs$1 digitalmars.com...

On 3/15/12 3:12 PM, Nick Sabalausky wrote:
 Anything an interpreter can do, a compiler can do. And dynamic typing
 doesn't have anything to do with interpreted vs compiled anyway.

Generating and running code during runtime is often easier in interpreted environments. Andrei
Mar 16 2012
prev sibling next sibling parent "so" <so so.so> writes:
Thank you all!

On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:
 On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:
 If so Lisp will be my first choice.

I just talked about D because D rox, but if you are doing it for education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.
 But for education, Lisp's uniqueness is a good thing -
 experiencing the new syntax and playing with the macros
 is a good way to learn things you might have not looked
 at otherwise.

I wouldn't mind learning something new! Looks like either way Lisp will be on my reading list.
Mar 15 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--20cf300faca190e89004bb4ceaad
Content-Type: text/plain; charset=UTF-8

On 15 March 2012 20:59, so <so so.so> wrote:

 Thank you all!


 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:

 On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:

 If so Lisp will be my first choice.

I just talked about D because D rox, but if you are doing it for education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :) --20cf300faca190e89004bb4ceaad Content-Type: text/html; charset=UTF-8 <div class="gmail_quote">On 15 March 2012 20:59, so <span dir="ltr">&lt;so so.so&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thank you all!<div class="im"> <br> <br> On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> If so Lisp will be my first choice.<br> </blockquote> <br> I just talked about D because D rox, but if you are doing<br> it for education, Lisp is a good choice because it is fairly<br> unique.<br> </blockquote> <br></div> I&#39;d love to use D but it is not an option is it? At least for the things i am after, say game scripting.</blockquote><div><br></div><div>I dunno, that sounds like a pretty interesting idea to me! :)</div></div> --20cf300faca190e89004bb4ceaad--
Mar 15 2012
prev sibling next sibling parent "Nick Sabalausky" <a a.a> writes:
"so" <so so.so> wrote in message 
news:uamqdkmnshxmvayeumbz forum.dlang.org...
 Hello,

 Not related to D but this is a community which i can find at least a few 
 objective person. I want to invest some "quality" time on a dynamic 
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be my 
 first choice.

I'd say it depends: - If can can tolerate the parenthesis-hell and goofy prefix notation (instead of infix), then LISP has been said to be the generalization of all other langauges. IIRC, I heard that it was created specifically as an example of a "programmable programming language". - If you're looking for performace and practical real-world usage as a way to add scripting support to a program, Lua is considerd king for that. - If you can stomach the indent-scoping, Python is very well-regarded and has a lot of fancy advanced features. - If you don't like indent-scoping, Ruby is probably about the closest there is to a block-scoped Python. - If you're looking for the most painful dynamic experince imaginable, ActionScript2 should be at the top of your list. Make sure to use all-Adobe tools, and the newest versions of each, so the whole experience will be *truly* unbearable. I admit though, I'm not very familiar with the extent of the metaprogramming abilities of any of those languages.
Mar 15 2012
prev sibling next sibling parent "so" <so so.so> writes:
On Thursday, 15 March 2012 at 19:25:24 UTC, Nick Sabalausky wrote:
 "so" <so so.so> wrote in message
 news:uamqdkmnshxmvayeumbz forum.dlang.org...
 Hello,

 Not related to D but this is a community which i can find at 
 least a few objective person. I want to invest some "quality" 
 time on a dynamic language but i am not sure which one. Would 
 you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so 
 Lisp will be my first choice.

I'd say it depends: - If can can tolerate the parenthesis-hell and goofy prefix notation (instead of infix), then LISP has been said to be the generalization of all other langauges. IIRC, I heard that it was created specifically as an example of a "programmable programming language". - If you're looking for performace and practical real-world usage as a way to add scripting support to a program, Lua is considerd king for that. - If you can stomach the indent-scoping, Python is very well-regarded and has a lot of fancy advanced features. - If you don't like indent-scoping, Ruby is probably about the closest there is to a block-scoped Python. - If you're looking for the most painful dynamic experince imaginable, ActionScript2 should be at the top of your list. Make sure to use all-Adobe tools, and the newest versions of each, so the whole experience will be *truly* unbearable. I admit though, I'm not very familiar with the extent of the metaprogramming abilities of any of those languages.

Metaprogramming abilities is the first thing i check now. After the painful experience of C/C++. I just can't "repeat" codes and when i have no options, i just curse the language :) Fanatics don't get it. How much a simple tool like "static if" improves the entire template mechanism and makes it something enjoyable. What the hell is a killer app if this is not for a programmer?
Mar 15 2012
prev sibling next sibling parent "so" <so so.so> writes:
On Thursday, 15 March 2012 at 19:35:15 UTC, Nick Sabalausky wrote:

 As for other langauges:

 Lua is currently *king* for game scripting. It's used all over 
 the gaming
 industry because it's fast and integrates with C very easily. 
 Personally, I
 don't like it because it *is* a dynamic langauge. But if you're 
 looking for
 a dynamic language, well, then there's that.

Not just because i am looking for, how would you code a customizable ui (wow ui for example) without an interpreter? You got no other options AFAIK when it comes to customizable stuff.
Mar 15 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Mar 15, 2012 at 09:15:34PM +0200, Manu wrote:
 On 15 March 2012 20:59, so <so so.so> wrote:

 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:


 I just talked about D because D rox, but if you are doing it for
 education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :)

It certainly is, though it does bring up the problem of what to do if the game scripting is editable at runtime. Does that mean we'll need to bundle a D compiler with the game? Doesn't seem practical. T -- Государство делает вид, что платит нам зарплату, а мы делаем вид, что работаем.
Mar 15 2012
parent "Nick Sabalausky" <a a.a> writes:
"H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message 
news:mailman.709.1331842273.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 09:15:34PM +0200, Manu wrote:
 On 15 March 2012 20:59, so <so so.so> wrote:

 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:


 I just talked about D because D rox, but if you are doing it for
 education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :)

It certainly is, though it does bring up the problem of what to do if the game scripting is editable at runtime. Does that mean we'll need to bundle a D compiler with the game? Doesn't seem practical.

Why not?
Mar 15 2012
prev sibling next sibling parent "Jesse Phillips" <Jessekphillips+D gmail.com> writes:
On Thursday, 15 March 2012 at 14:55:20 UTC, H. S. Teoh wrote:

 Bash?? Are you serious?!

It is terrible as a programming language, I will give you that. But in terms of something useful to learn, it has been. But I would say if it is going to take up more than a screen (terminal size) then I'll be using D.
Mar 15 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Mar 15, 2012 at 03:24:24PM -0400, Nick Sabalausky wrote:
[...]
 - If you can stomach the indent-scoping, Python is very well-regarded
 and has a lot of fancy advanced features.

I used to despise Python's indent-scoping too, though since then I've had some opportunity to use Python for build scripts (google for SCons), and I have to say that it certainly has its own kind of beauty to it. You never have to worry about closing blocks in if statements and the like, for example, and you never have subtle bugs like: auto func(bool x) { int y=0; if (x) y = 1; writeln("x is true"); return y; } But I certainly sympathize with the WAT sentiment when one first learns that Python has indent scoping. :-) [...]
 - If you're looking for the most painful dynamic experince imaginable,
 ActionScript2 should be at the top of your list. Make sure to use
 all-Adobe tools, and the newest versions of each, so the whole
 experience will be *truly* unbearable.

Shouldn't that be ActionScript3? (And no, I would not touch any of this stuff with a 10-foot pole.)
 I admit though, I'm not very familiar with the extent of the
 metaprogramming abilities of any of those languages.

I can't say I'm familiar with all the languages you listed either, but in my limited experience, I find that D's metaprogramming capabilities outright beats every other language I know by a loooong shot. C++ seems to come farther than most other languages, but its horrible template syntax is just ... unpalatable. I mean, before C++11, even something as straightforward as vector<vector<int>> is a syntax error. How ridiculous is that?! Nevermind the dubious wisdom of using <> for template arguments in the first place (try, e.g., a template with bool arguments that you want to instantiate with expressions that have comparison operators). Sure, C++ templates are Turing-complete. They're also Turing tarpits for anything except the most trivial uses. D templates + CTFE rox the sox off C++ any day. (P.S. From what I heard, Lisp trumps D in metaprogramming abilities, but I don't know Lisp so I can't comment on that.) T -- Windows 95 was a joke, and Windows 98 was the punchline.
Mar 15 2012
next sibling parent "Nick Sabalausky" <a a.a> writes:
"H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message 
news:mailman.712.1331843803.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 03:24:24PM -0400, Nick Sabalausky wrote:
 [...]
 - If you can stomach the indent-scoping, Python is very well-regarded
 and has a lot of fancy advanced features.

I used to despise Python's indent-scoping too, though since then I've had some opportunity to use Python for build scripts (google for SCons), and I have to say that it certainly has its own kind of beauty to it. You never have to worry about closing blocks in if statements and the like, for example, and you never have subtle bugs like: auto func(bool x) { int y=0; if (x) y = 1; writeln("x is true"); return y; } But I certainly sympathize with the WAT sentiment when one first learns that Python has indent scoping. :-)

I've used some Python, and I've done a fair amount of SPIN (Parallax's Propeller microcontroller) which also does indent-scoping. Granted, SPIN is a lousy language (the Propeller is awesome though) regardless of its indent-scoping, but still, even the indent-scoping *itself* never ceased being irritating for me, for various different reasons. I do like the indent-scoping in YAML, though. But that's very different: It's optional in YAML and YAML's only a data langauge, not a programming language. As far as SCons, though, I haven't done much with it, but I have looked into it. Even though it techically is Python, I'd argue that its charter leaves it somewhat more similar to YAML than actually writing a whole program in Python.
 [...]
 - If you're looking for the most painful dynamic experince imaginable,
 ActionScript2 should be at the top of your list. Make sure to use
 all-Adobe tools, and the newest versions of each, so the whole
 experience will be *truly* unbearable.

Shouldn't that be ActionScript3?

I've never used ActionScript3. I've heared it's better, but I have no idea how much better. ActionScript2 is truly horrid though. Almost any error that isn't an outright syntax error is *completely* ignored. So if you sneeze wrong near one end of the codebase, then something clear over in another section will just...act wrong, for no apperent reason. I've wasted hours on things like trying to figure out why an image or text wasn't showing up, or was displayed wrong, just becase I declared some *other* object or array and forgot to manually initialize it with a "new MyClass()" or a "new Array()". That's right: you can dereference null, but it isn't an error: it's a no-op that triggers a cascade of no-ops. (And shit, even the heavily-static D lets you declare an array and just start appending to it - and have the data actually *stick* and not be mysteriously gone when you try to read it back.) The API is awful, too. MovieClip, the *foundation* of AS2-based Flash, has got to be the most poorly designed sprite class I've ever seen. When I switched to Haxe, I ended up going to great lengths to wrap MovieClip in a much more sane Sprite class. I think the only way they could have made ActionScript2 worse is if they made it indent-syntax. Ok, and entirely removed what little declaring and type-tagging it does have. And the IDE is wretched. It has one of the most awkward editors I've used, and the bloat...christ, the bloat gets twice as bad with each version, the UI gets more goofily-skinned with each version, and the bloat in CS5 - honest to god - it makes a fully loaded Eclipse seem downright *lean*.
 (And no, I would not touch any of this stuff with a 10-foot pole.)

With ActionScript, ignorance truly is bliss. I'd probably be a happier, [somewhat] less disgruntled man if I'd never needed to use it.
 I admit though, I'm not very familiar with the extent of the
 metaprogramming abilities of any of those languages.

I can't say I'm familiar with all the languages you listed either, but in my limited experience, I find that D's metaprogramming capabilities outright beats every other language I know by a loooong shot.

Yea, I do agree. Admittedly D isn't "dynamic" enough to do so called "monkey patching" like some languages can, but really that's a *benefit*. From what I've seen, dynamic and interpreted languages generally prefer to do runtime tricks *instead* of things we would consider "metaprogramming". Which does stay neatly in line with the standard dynamic/interpreted manifesto of "Efficiency? What's that?"
 C++ seems to come farther than most other languages, but its horrible
 template syntax is just ... unpalatable. I mean, before C++11, even
 something as straightforward as vector<vector<int>> is a syntax error.
 How ridiculous is that?!

Seriously? Christ, I knew it was bad, but I'd never have guessed anything like that. Even Haxe can handle that.
 Nevermind the dubious wisdom of using <> for
 template arguments in the first place (try, e.g., a template with bool
 arguments that you want to instantiate with expressions that have
 comparison operators).  Sure, C++ templates are Turing-complete. They're
 also Turing tarpits for anything except the most trivial uses.

 D templates + CTFE rox the sox off C++ any day.

God yes. The only thing I've ever seen that comes close is Nemerle, which takes a whole different approach that's both better and worse than D, just in different ways. But Nemerle's strictly locked behind the VM wall (.NET), so it's not exactly the same class of language as D.
Mar 15 2012
prev sibling parent "Paulo Pinto" <pjmlp progtools.org> writes:
To be fair Python is not alone, all the ML languages (Ocaml, Haskell, F#, 
...) also work that way.

F# was even funnier. While the language was experimental the default mode 
was still like most
languages, and a "#light" mode was available, similar to what ML-like 
languages have.

Due to the amount of feedback received, by the time F# was an official MSVC 
language, the indentation
based "#light" mode was the default.

--
Paulo

"H. S. Teoh"  wrote in message 
news:mailman.712.1331843803.4860.digitalmars-d puremagic.com...

On Thu, Mar 15, 2012 at 03:24:24PM -0400, Nick Sabalausky wrote:
[...]
 - If you can stomach the indent-scoping, Python is very well-regarded
 and has a lot of fancy advanced features.

I used to despise Python's indent-scoping too, though since then I've had some opportunity to use Python for build scripts (google for SCons), and I have to say that it certainly has its own kind of beauty to it. You never have to worry about closing blocks in if statements and the like, for example, and you never have subtle bugs like: auto func(bool x) { int y=0; if (x) y = 1; writeln("x is true"); return y; } But I certainly sympathize with the WAT sentiment when one first learns that Python has indent scoping. :-) (...) cutted
Mar 16 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Mar 15, 2012 at 04:13:42PM -0400, Nick Sabalausky wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message 
 news:mailman.709.1331842273.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 09:15:34PM +0200, Manu wrote:
 On 15 March 2012 20:59, so <so so.so> wrote:

 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:


 I just talked about D because D rox, but if you are doing it for
 education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :)

It certainly is, though it does bring up the problem of what to do if the game scripting is editable at runtime. Does that mean we'll need to bundle a D compiler with the game? Doesn't seem practical.

Why not?

So your game will have to ship with dmd and optlink bundled? T -- "The number you have dialed is imaginary. Please rotate your phone 90 degrees and try again."
Mar 15 2012
parent "Nick Sabalausky" <a a.a> writes:
"H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message 
news:mailman.713.1331843912.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 04:13:42PM -0400, Nick Sabalausky wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message
 news:mailman.709.1331842273.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 09:15:34PM +0200, Manu wrote:
 On 15 March 2012 20:59, so <so so.so> wrote:

 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:


 I just talked about D because D rox, but if you are doing it for
 education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :)

It certainly is, though it does bring up the problem of what to do if the game scripting is editable at runtime. Does that mean we'll need to bundle a D compiler with the game? Doesn't seem practical.

Why not?

So your game will have to ship with dmd and optlink bundled?

As long as it's a platform on which dmd runs, and you have permission from Walter, I don't see the problem with that. Sure, it'd be another thing to deal with in the installation/packaging scripts, but it shouldn't be too bad. Plus, people have already done the same sort of thing with Python/Ruby (not sure about games, but other apps). Yea, scripting in Python/Ruby is probably super-easy if your app is already written in Python/Ruby, but when isn't then you're really just doing the same thing as you would to do your scripting in D. 'Course, if you *like* dynamic interpreted languages, then yea, just simply using Lua would be easier. Point is though, I don't think I'd say it's impractical with D. At least for desktop/laptop games anyway (platforms dmd doesn't run *on* could still use D for scripting, but just not edited in-game - could still reload in-game if the platform has dynamic lib support, but it'd be compiled off-line...possibly even by the game sending the code to a compile server). And all that would only matter for user-generated content. Any built-in scripts would naturally just already come pre-built. Hell, they could even come statically-linked if you wanted - develop them using the dynamic editing tools, and then statically link when you're ready to ship. Speaking of such things, I wonder how hard it would be to port dmd to run on another platform? Targeting that platform might be a lot of work, but just making it run on it...it *is* written in C++, probably the second-most common language in the world (just behind straight C), and it's not like it does a bunch direct hardware I/O access, or GUI, or anything like that. So I'd imagine mostly just some occasional OS calls and assembly. Don't know how much of that there is in there.
 -- 
 "The number you have dialed is imaginary. Please rotate your phone 90 
 degrees and try again."

I love this one :)
Mar 15 2012
prev sibling next sibling parent James Miller <james aatch.net> writes:
On 16 March 2012 09:38, H. S. Teoh <hsteoh quickfur.ath.cx> wrote:
 (P.S. From what I heard, Lisp trumps D in metaprogramming abilities, but
 I don't know Lisp so I can't comment on that.)

Greenspun's Tenth Law states that any time a programming language adds a new feature, it moves closer to becoming a poorly-made Lisp. While this is obviously slight hyperbole, Lisp is ridiculous in how you can pretty much just add new features to language using the language itself. The syntax is weird, but I guess its just one of those "You just get used to it" things. For example, CLOS is the Common Lisp Object System, and provides OO in Lisp. It is written /in/ Lisp. It supports all of the traditional polymorphism and encapsulation and all that, but also provides support for extending objects by defining before and after methods, fine grained control of how parent functions get called, all sorts of things like that. And while people talk about Lisp's macros, they often don't even realise that Lisp's macros are actually just one part of set of tools for generic programming and language extension. The only thing that drove me off Lisp is how different the development process is to regular programming. It uses image-based development, rather than source-based, and I still don't get how that's supposed to work. Some things are fairly esoteric, things like cons lists, car and cdr, I don't really get it, and the mental hurdle is ridiculous. On top of that, there is surprisingly little newbie-friendly documentation on it. There are tutorials and all that, but most focus on the language, not the development process. It gets really hard to figure out what to do when the interpreter is giving you some strange message and asking you a question that you don't understand. Well that's my experience with Lisp. -- James Miller
Mar 15 2012
prev sibling next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Thu, 15 Mar 2012 03:09:37 -0400, so <so so.so> wrote:

 Hello,

 Not related to D but this is a community which i can find at least a few  
 objective person. I want to invest some "quality" time on a dynamic  
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be  
 my first choice.

This may be a throw-away suggestion, because I've never used it (I don't know the quality/stability of it), but Jarrett Billingsly used to be a very active part of the D community, and he had a dynamic language kind of like D called miniD. It's now called croc. http://jfbillingsley.com/croc/wiki It's actually written in D (I think in D1). -Steve
Mar 15 2012
prev sibling next sibling parent J Arrizza <cppgent0 gmail.com> writes:
--047d7b2ed8af6b313e04bb4e9a31
Content-Type: text/plain; charset=ISO-8859-1

Ruby, hands down.

- Strong OO language. I believe it was partially based on smalltalk.
- The Object model is very well done, every thing is a first-class object.
- Meta-programming is easy to do
- has good support in IDEs like eclipse and RubyMine
- the gem library is huge and comprehensive - might be very close to CPAN
and Python's.
- concise, simple language with little in the way of "grammar bling" (but
check out
http://chris-schmitz.com/ruby-question-marks-and-exclamation-points/  )
- some good frameworks/tools/utilities out there like Ruby on Rails, Rake,
scons, rdoc, etc
- good community support (rubyforge.org)
- some oddball, niche things out there too
     - JRuby to write GUI applications. Runs on the JVM and has access to
the JDK classes like Swing, AWT, etc.
     - Ruby over JRuby on Android
http://gonegoogling.com/2010/08/30/get-ready-to-ditch-java-creating-android-applications-with-ruby-using-ruboto/

Downside: the name. "ruby" means something to the outside world, expect
google to bring you to jewelry stores, restaurants and Pokemon sites.

John

--047d7b2ed8af6b313e04bb4e9a31
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Ruby, hands down. =A0<div><br></div><div>- Strong OO language. I believe it=
 was partially based on smalltalk.<div>- The Object model is very well done=
, every thing is a first-class object.=A0<br></div><div>- Meta-programming =
is easy to do</div>
<div>- has good support in IDEs like eclipse and RubyMine</div><div>- the g=
em library is huge and comprehensive - might be very close to CPAN and Pyth=
on&#39;s.</div><div>- concise, simple language with little in the way of &q=
uot;grammar bling&quot; (but check out=A0<a href=3D"http://chris-schmitz.co=
m/ruby-question-marks-and-exclamation-points/">http://chris-schmitz.com/rub=
y-question-marks-and-exclamation-points/</a>=A0 )</div>
<div>- some good frameworks/tools/utilities out there like Ruby on Rails, R=
ake, scons, rdoc, etc</div><div>- good community support (<a href=3D"http:/=
/rubyforge.org">rubyforge.org</a>)</div><div>- some oddball, niche things o=
ut there too</div>
<div>=A0 =A0 =A0- JRuby to write GUI applications. Runs on the JVM and has =
access to the JDK classes like Swing, AWT, etc.</div><div>=A0 =A0 =A0- Ruby=
 over JRuby on Android=A0<a href=3D"http://gonegoogling.com/2010/08/30/get-=
ready-to-ditch-java-creating-android-applications-with-ruby-using-ruboto/">=
http://gonegoogling.com/2010/08/30/get-ready-to-ditch-java-creating-android=
-applications-with-ruby-using-ruboto/</a><br>
</div><div><br></div><div>Downside:=A0the name. &quot;ruby&quot; means some=
thing to the outside world, expect google to bring you to jewelry stores, r=
estaurants and Pokemon sites.</div><div><br></div><div>John</div><div><br>
</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br>=
</div><div><div><br></div><div><br></div></div></div>

--047d7b2ed8af6b313e04bb4e9a31--
Mar 15 2012
prev sibling next sibling parent James Miller <james aatch.net> writes:
On 16 March 2012 04:28, Andrei Alexandrescu
<SeeWebsiteForEmail erdani.org> wrote:
 Relevant insight:
 http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-sta=

 Andrei

That was a cool article. The comments are amusing, all the people not really understanding the point. "e.g. if you change some type in your Haskell code, you have to fix every use of that type before you can test anything. Surely you=E2=80=99ve found that annoying?=E2=80=9D, *cough*Type Inference*cough*. Even D has type inference through auto. -- James Miller
Mar 15 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
 Paulo Pinto wrote:
 The main benefit dynamic languages bring to the table is not 
 requiring to
 write types everywhere, duck typing, and the flexibility 
 metaprogramming
 has.

I'll give you the metaprogramming bit, but duck-typing is rarely a benefit over languages, like D and C#, which support "auto"/"var" keywords. I'd actually argue that getting early compile-time error when I accidentally change variable type (except in areas I explicitly want it) is actually a time saver of statically typed languages. Granted casting types is a bit lower-level concept and can be a pain to type.
 Andrei Alexandrescu wrote:
 Relevant insight: 
 http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/

Thanks for the link. I understand all code eventually becomes binary, of course, and I have a pretty good understanding of how V8 JS functions internally. I just can't see why someone would want to use an "expressively straightjacketed" (as the article puts it) language when they have the option not to.
 Adam D. Ruppe wrote:
 import std.variant;
 struct Extendable {
     Variant[string] properties;
     Variant opDispatch(string name)() {
        return properties[name];
     }
     Variant opDispatch(string name, T)(T t) {
        properties[name] = t;
        return properties[name];
     }
 }
 
 void main() {
     auto a = Extendable();
     a.sweet = 10;
     a.cool = { a.sweet = a.sweet + 1; }
     a.cool();
 }

Awesome! I knew it was possible, just didn't think it'd be that easy! You know, it might be nice to an std.dynamic or extend variant to include a general purpose Dynamic type. Just a thought.
 so Wrote:
 I'd love to use D but it is not an option is it? At least for 
 the
 things i am after, say game scripting.

I think D's a great option. A D compiler would only have to be distributed with the tool-chain/editor, and scripts could be statically compiled with the rest of engine. Safe-D is safe, and comparably easy to understand as other common scripting languages (Unity's uses C# for example) and advanced scripters would have the options of getting real low-level with their logic blocks. Plus, if the rest of the game engine was written in D, integrating the scripts would be completely seamless. ~~~~~~~~~~ On a completely irrelevant, but slightly related note: I have just released my first Unity 3D game for Android/iPhone, Space Pizza Delivery! (https://play.google.com/store/apps/details?id=com.ReignStudios.SpacePizzaDelivery) Woohoo! It's simple, but fun, and we have a much more ambitious project in the works. Hopefully the start of my game-maker career! :-D (and yes, I am shamelessly advertising ;p)
Mar 15 2012
prev sibling next sibling parent Brad Anderson <eco gnuk.net> writes:
--f46d04426e9206339204bb4f7f4d
Content-Type: text/plain; charset=ISO-8859-1

On Thu, Mar 15, 2012 at 3:56 PM, F i L <witte2008 gmail.com> wrote:

 Paulo Pinto wrote:
 The main benefit dynamic languages bring to the table is not requiring to
 write types everywhere, duck typing, and the flexibility metaprogramming
 has.

I'll give you the metaprogramming bit, but duck-typing is rarely a benefit over languages, like D and C#, which support "auto"/"var" keywords. I'd actually argue that getting early compile-time error when I accidentally change variable type (except in areas I explicitly want it) is actually a time saver of statically typed languages. Granted casting types is a bit lower-level concept and can be a pain to type. Andrei Alexandrescu wrote:
 Relevant insight: http://existentialtype.**wordpress.com/2011/03/19/**
 dynamic-languages-are-static-**languages/<http://existentialtype.wordpress.com/2011/03/19/dynamic-languages-are-static-languages/>

Thanks for the link. I understand all code eventually becomes binary, of course, and I have a pretty good understanding of how V8 JS functions internally. I just can't see why someone would want to use an "expressively straightjacketed" (as the article puts it) language when they have the option not to. Adam D. Ruppe wrote:
 import std.variant;
 struct Extendable {
    Variant[string] properties;
    Variant opDispatch(string name)() {
       return properties[name];
    }
    Variant opDispatch(string name, T)(T t) {
       properties[name] = t;
       return properties[name];
    }
 }

 void main() {
    auto a = Extendable();
    a.sweet = 10;
    a.cool = { a.sweet = a.sweet + 1; }
    a.cool();
 }

Awesome! I knew it was possible, just didn't think it'd be that easy! You know, it might be nice to an std.dynamic or extend variant to include a general purpose Dynamic type. Just a thought. so Wrote:
 I'd love to use D but it is not an option is it? At least for the
 things i am after, say game scripting.

I think D's a great option. A D compiler would only have to be distributed with the tool-chain/editor, and scripts could be statically compiled with the rest of engine. Safe-D is safe, and comparably easy to understand as other common scripting languages (Unity's uses C# for example) and advanced scripters would have the options of getting real low-level with their logic blocks. Plus, if the rest of the game engine was written in D, integrating the scripts would be completely seamless. ~~~~~~~~~~ On a completely irrelevant, but slightly related note: I have just released my first Unity 3D game for Android/iPhone, Space Pizza Delivery! ( https://play.google.com/**store/apps/details?id=com.**ReignStudios.** SpacePizzaDelivery<https://play.google.com/store/apps/details?id=com.ReignStudios.SpacePizzaDelivery> ) Woohoo! It's simple, but fun, and we have a much more ambitious project in the works. Hopefully the start of my game-maker career! :-D (and yes, I am shamelessly advertising ;p)

Got a score of 292 while spending most of the time with just a sliver of life. Those sneaky health powerups kept getting knocked off the screen before they'd reach me. Fun though. Regards, Brad Anderson --f46d04426e9206339204bb4f7f4d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Mar 15, 2012 at 3:56 PM, F i L <span dir=3D"ltr">&lt;<a href=3D"mai= lto:witte2008 gmail.com">witte2008 gmail.com</a>&gt;</span> wrote:<br><div = class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0= 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .= 8ex;border-left:1px #ccc solid;padding-left:1ex"> Paulo Pinto wrote:<br> The main benefit dynamic languages bring to the table is not requiring to<b= r> write types everywhere, duck typing, and the flexibility metaprogramming<br=

</blockquote> <br></div> I&#39;ll give you the metaprogramming bit, but duck-typing is rarely a bene= fit over languages, like D and C#, which support &quot;auto&quot;/&quot;var= &quot; keywords. I&#39;d actually argue that getting early compile-time err= or when I accidentally change variable type (except in areas I explicitly w= ant it) is actually a time saver of statically typed languages. Granted cas= ting types is a bit lower-level concept and can be a pain to type.<div clas= s=3D"im"> <br> <br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> Andrei Alexandrescu wrote:<br> Relevant insight: <a href=3D"http://existentialtype.wordpress.com/2011/03/1= 9/dynamic-languages-are-static-languages/" target=3D"_blank">http://existen= tialtype.<u></u>wordpress.com/2011/03/19/<u></u>dynamic-languages-are-stati= c-<u></u>languages/</a><br> </blockquote> <br></div> Thanks for the link. I understand all code eventually becomes binary, of co= urse, and I have a pretty good understanding of how V8 JS functions interna= lly. I just can&#39;t see why someone would want to use an &quot;expressive= ly straightjacketed&quot; (as the article puts it) language when they have = the option not to.<br> <br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div class=3D"im"> Adam D. Ruppe wrote:<br> import std.variant;<br> struct Extendable {<br> =A0 =A0Variant[string] properties;<br> =A0 =A0Variant opDispatch(string name)() {<br> =A0 =A0 =A0 return properties[name];<br> =A0 =A0}<br> =A0 =A0Variant opDispatch(string name, T)(T t) {<br> =A0 =A0 =A0 properties[name] =3D t;<br> =A0 =A0 =A0 return properties[name];<br> =A0 =A0}<br> }<br> <br> void main() {<br> =A0 =A0auto a =3D Extendable();<br> =A0 =A0a.sweet =3D 10;<br> =A0 =A0a.cool =3D { a.sweet =3D a.sweet + 1; }<br></div> =A0 =A0a.cool();<br> }<br> </blockquote> <br> Awesome! I knew it was possible, just didn&#39;t think it&#39;d be that eas= y! You know, it might be nice to an std.dynamic or extend variant to includ= e a general purpose Dynamic type. Just a thought.<div class=3D"im"><br> <br> <br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> so Wrote:<br> I&#39;d love to use D but it is not an option is it? At least for the<br> things i am after, say game scripting.<br> </blockquote> <br></div> I think D&#39;s a great option. A D compiler would only have to be distribu= ted with the =A0tool-chain/editor, and scripts could be statically compiled= with the rest of engine. Safe-D is safe, and comparably easy to understand= as other common scripting languages (Unity&#39;s uses C# for example) and = advanced scripters would have the options of getting real low-level with th= eir logic blocks. Plus, if the rest of the game engine was written in D, in= tegrating the scripts would be completely seamless.<br> <br> <br> ~~~~~~~~~~<br> <br> <br> On a completely irrelevant, but slightly related note: I have just released= my first Unity 3D game for Android/iPhone, Space Pizza Delivery! (<a href= =3D"https://play.google.com/store/apps/details?id=3Dcom.ReignStudios.SpaceP= izzaDelivery" target=3D"_blank">https://play.google.com/<u></u>store/apps/d= etails?id=3Dcom.<u></u>ReignStudios.<u></u>SpacePizzaDelivery</a>)<br> <br> Woohoo! It&#39;s simple, but fun, and we have a much more ambitious project= in the works. Hopefully the start of my game-maker career! :-D (and yes, I= am shamelessly advertising ;p)<br> </blockquote></div><br><div>Got a score of 292 while spending most of the t= ime with just a sliver of life. =A0Those sneaky health powerups kept gettin= g knocked off the screen before they&#39;d reach me. =A0Fun though.</div><d= iv> <br></div><div>Regards,</div><div>Brad Anderson</div> --f46d04426e9206339204bb4f7f4d--
Mar 15 2012
prev sibling next sibling parent Manu <turkeyman gmail.com> writes:
--20cf3074b5a2221d4f04bb4fbbd0
Content-Type: text/plain; charset=UTF-8

On 15 March 2012 22:12, H. S. Teoh <hsteoh quickfur.ath.cx> wrote:

 On Thu, Mar 15, 2012 at 09:15:34PM +0200, Manu wrote:
 On 15 March 2012 20:59, so <so so.so> wrote:

 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:


 I just talked about D because D rox, but if you are doing it for
 education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :)

It certainly is, though it does bring up the problem of what to do if the game scripting is editable at runtime. Does that mean we'll need to bundle a D compiler with the game? Doesn't seem practical.

Do you expect users to be modifying the scripts in the retail release? Surely scripting is still for what it has always been for, rapid iteration/prototyping during development. Hot-plugging DLL's written in D sounds pretty interesting to me :) .. You only need the compiler as a part of the games asset-pipeline, and can static link when you release for extra FPS's! --20cf3074b5a2221d4f04bb4fbbd0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div class=3D"gmail_quote">On 15 March 2012 22:12, H. S. Teoh <span dir=3D"= ltr">&lt;<a href=3D"mailto:hsteoh quickfur.ath.cx">hsteoh quickfur.ath.cx</= a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0= 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <div class=3D"im">On Thu, Mar 15, 2012 at 09:15:34PM +0200, Manu wrote:<br> &gt; On 15 March 2012 20:59, so &lt;so so.so&gt; wrote:<br> </div>[...]<br> <div class=3D"im">&gt; &gt; On Thursday, 15 March 2012 at 17:30:49 UTC, Ada= m D. Ruppe wrote:<br> </div>[...]<br> <div class=3D"im">&gt; &gt;&gt; I just talked about D because D rox, but if= you are doing it for<br> &gt; &gt;&gt; education, Lisp is a good choice because it is fairly unique.= <br> &gt; &gt;&gt;<br> &gt; &gt;<br> &gt; &gt; I&#39;d love to use D but it is not an option is it? At least for= the<br> &gt; &gt; things i am after, say game scripting.<br> &gt;<br> &gt;<br> &gt; I dunno, that sounds like a pretty interesting idea to me! :)<br> <br> </div>It certainly is, though it does bring up the problem of what to do if= <br> the game scripting is editable at runtime. Does that mean we&#39;ll need to= <br> bundle a D compiler with the game? Doesn&#39;t seem practical.<br></blockqu= ote><div><br></div><div>Do you expect users to be modifying the scripts in = the retail release?</div><div>Surely scripting is still for what it has alw= ays been for, rapid iteration/prototyping during development.</div> <div>Hot-plugging DLL&#39;s written in D sounds pretty interesting to me :)= .. You only need the compiler as a part of the games asset-pipeline, and c= an static link when you release for extra FPS&#39;s!</div></div> --20cf3074b5a2221d4f04bb4fbbd0--
Mar 15 2012
prev sibling next sibling parent James Miller <james aatch.net> writes:
On 16 March 2012 11:37, Manu <turkeyman gmail.com> wrote:
 Do you expect users to be modifying the scripts in the retail release?
 Surely scripting is still for what it has always been for, rapid
 iteration/prototyping during development.
 Hot-plugging DLL's written in D sounds pretty interesting to me :) .. You
 only need the compiler as a part of the games asset-pipeline, and can static
 link when you release for extra FPS's!

Also, less files to download, I like a lot of indie games because they are often a single binary, more things need to have the assets compiled in... -- James Miller
Mar 15 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
Brad Anderson wrote:
 Got a score of 292 while spending most of the time with just a 
 sliver of
 life.  Those sneaky health powerups kept getting knocked off 
 the screen
 before they'd reach me.  Fun though.

 Regards,
 Brad Anderson

Ha! I once got a score of ~1,200 on my Tablet. You get more points by shooting asteroids and picking up the items. Thanks for the support, btw! :D
Mar 15 2012
prev sibling next sibling parent reply "Derek Parnell" <ddparnell bigpond.com> writes:
On Thu, 15 Mar 2012 18:09:37 +1100, so <so so.so> wrote:

 Hello,

 Not related to D but this is a community which i can find at least a few  
 objective person. I want to invest some "quality" time on a dynamic  
 language but i am not sure which one. Would you please suggest one?

 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp will be  
 my first choice.

I'm not so objective, but don't let that dissuade you. For a programmable language, you might want to look at Forth. I use it as an embedded scripting language in a couple of my programs. For a language that has built-in static types and built-in dynamic types, you might want to check out the Euphoria language at http://www.openeuphoria.org and also as a web language: http://openeuphoria.org/forum/117802.wc?last_id=117805 -- Derek
Mar 15 2012
parent "Nick Sabalausky" <a a.a> writes:
"Derek Parnell" <ddparnell bigpond.com> wrote in message 
news:op.wa8hg1dimqne79 derrick-pc.spareco.local...
 For a programmable language, you might want to look at Forth. I use it as 
 an embedded scripting language in a couple of my programs.

Forth is one of those rare ones that seems to be both a real language and a joke langauge at the same time :) I don't know whether to love it or hate it!
Mar 15 2012
prev sibling next sibling parent reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Mar 15, 2012 at 06:15:39PM -0400, Nick Sabalausky wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message 
 news:mailman.713.1331843912.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 04:13:42PM -0400, Nick Sabalausky wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message
 news:mailman.709.1331842273.4860.digitalmars-d puremagic.com...



 It certainly is, though it does bring up the problem of what to
 do if the game scripting is editable at runtime. Does that mean
 we'll need to bundle a D compiler with the game? Doesn't seem
 practical.

Why not?

So your game will have to ship with dmd and optlink bundled?

As long as it's a platform on which dmd runs, and you have permission from Walter, I don't see the problem with that. Sure, it'd be another thing to deal with in the installation/packaging scripts, but it shouldn't be too bad.

Oh, I wasn't worried about the licensing part. It's more about needing to ship dmd + druntime sources (and possibly some game-specific .d libraries), plus optlink. Which is not horrible, I suppose. But it feels a bit like buying a chair from IKEA and getting a toolbox, a full set of tools, 5 boxes of nails of different types, a power-drill, an engine replacement kit, and a sledgehammer included in the box. :-)
 Plus, people have already done the same sort of thing with Python/Ruby
 (not sure about games, but other apps). Yea, scripting in Python/Ruby
 is probably super-easy if your app is already written in Python/Ruby,
 but when isn't then you're really just doing the same thing as you
 would to do your scripting in D.

True.
 'Course, if you *like* dynamic interpreted languages, then yea, just
 simply using Lua would be easier. Point is though, I don't think I'd
 say it's impractical with D. At least for desktop/laptop games anyway
 (platforms dmd doesn't run *on* could still use D for scripting, but
 just not edited in-game - could still reload in-game if the platform
 has dynamic lib support, but it'd be compiled off-line...possibly even
 by the game sending the code to a compile server).

Actually, I like this idea. Don't ship the compiler/linker (which feels like overkill), but user-generated scripts will be compiled by an online server and sent back to the game as a DLL. Although that does have potential for abuse... somebody could figure out the game/server protocol and use it as a compile-farm for arbitrary D code. Or write a "script" that contains a complete D app and use the game to compile it "for free" using the game server's resources. It can also be a security concern. Somebody could offer players an "awesome script" in DLL form that actually contains arbitrary exploit code. Or a "script" that contains D code for an exploit.
 And all that would only matter for user-generated content. Any
 built-in scripts would naturally just already come pre-built. Hell,
 they could even come statically-linked if you wanted - develop them
 using the dynamic editing tools, and then statically link when you're
 ready to ship.

I like this.
 Speaking of such things, I wonder how hard it would be to port dmd to
 run on another platform? Targeting that platform might be a lot of
 work, but just making it run on it...it *is* written in C++, probably
 the second-most common language in the world (just behind straight C),
 and it's not like it does a bunch direct hardware I/O access, or GUI,
 or anything like that. So I'd imagine mostly just some occasional OS
 calls and assembly. Don't know how much of that there is in there.

What's the point of dmd running on some platform but unable to generate code for it? Cross-compiling from your Android to your PC? Sounds a bit backwards to me. :-) (Though it might be useful if you're travelling and working on code on a portable device.) [...]
 "The number you have dialed is imaginary. Please rotate your phone
 90 degrees and try again."

I love this one :)

A related one: Life is complex. It consists of real and imaginary parts. T -- There are three kinds of people in the world: those who can count, and those who can't.
Mar 15 2012
parent "Nick Sabalausky" <a a.a> writes:
"H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message 
news:mailman.730.1331851930.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 06:15:39PM -0400, Nick Sabalausky wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message
 news:mailman.713.1331843912.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 04:13:42PM -0400, Nick Sabalausky wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message
 news:mailman.709.1331842273.4860.digitalmars-d puremagic.com...



 It certainly is, though it does bring up the problem of what to
 do if the game scripting is editable at runtime. Does that mean
 we'll need to bundle a D compiler with the game? Doesn't seem
 practical.

Why not?

So your game will have to ship with dmd and optlink bundled?

As long as it's a platform on which dmd runs, and you have permission from Walter, I don't see the problem with that. Sure, it'd be another thing to deal with in the installation/packaging scripts, but it shouldn't be too bad.

Oh, I wasn't worried about the licensing part. It's more about needing to ship dmd + druntime sources (and possibly some game-specific .d libraries), plus optlink. Which is not horrible, I suppose. But it feels a bit like buying a chair from IKEA and getting a toolbox, a full set of tools, 5 boxes of nails of different types, a power-drill, an engine replacement kit, and a sledgehammer included in the box. :-)

And a robot that actually uses all of those to build your chair for you, then cleans up, backs off and stays out of your way ;)
 'Course, if you *like* dynamic interpreted languages, then yea, just
 simply using Lua would be easier. Point is though, I don't think I'd
 say it's impractical with D. At least for desktop/laptop games anyway
 (platforms dmd doesn't run *on* could still use D for scripting, but
 just not edited in-game - could still reload in-game if the platform
 has dynamic lib support, but it'd be compiled off-line...possibly even
 by the game sending the code to a compile server).

Actually, I like this idea. Don't ship the compiler/linker (which feels like overkill), but user-generated scripts will be compiled by an online server and sent back to the game as a DLL.

To me, sending code off to a server to be compiled sounds like a bigger overkill ;) But, nonetheless, I think it could be a reasonable solution for targets on which the compiler won't actually run. Actually, what got me thinking about that is the Corona SDK (for iOS/Android development). One, umm...interesting...thing about it is that your code is *always* compiled on *their* servers. I felt that would be a major drawback for real professinal development: I wouldn't want to have to *rely* on them and their servers (and me having a good connection to them) just to compile *my* code. It made me uneasy about privacy and security, too: "Could someone be monitoring my coding?" "Could things I didn't expect (or that Corona themselves didn't expect - ex, if they got hacked) get inserted into my code?". It was clear to me though, that it was intended primarily as a license-enforcement measure (Corona is licensed per year): You have to login to use it (even for trial users), and it's the *only* way to build a Corona SDK application, so if you're not licensed the *only* way to use it would be to hack your way in. Ultimately, I thought it was one of a handful of marks against Corona. Nonetheless, I thought it was an interesting idea.
 Although that does have potential for abuse... somebody could figure out
 the game/server protocol and use it as a compile-farm for arbitrary D
 code. Or write a "script" that contains a complete D app and use the
 game to compile it "for free" using the game server's resources.

Yea, that's true. There are ways of dealing with that, of course, but it's one more thing you'd have to deal with.
 It can also be a security concern. Somebody could offer players an
 "awesome script" in DLL form that actually contains arbitrary exploit
 code. Or a "script" that contains D code for an exploit.

True, but depending on how things are implemented, trojans can exist on dynamic/interpreted plug-ins, too. Yea, the source would likely be available, but how many people - even intelligent, professional, security-minded professinals - ever read and audit the source of a plug-in before trying it out? It'd be too impractical - you'd never get anything done! Also, with the "on server" compiling, you could (at least in theory) do special checks for certain types of game exploits, security exploits, etc. (Although, you could do that with a customized bundled compiler, too, but it'd be harder to enforce.)
 And all that would only matter for user-generated content. Any
 built-in scripts would naturally just already come pre-built. Hell,
 they could even come statically-linked if you wanted - develop them
 using the dynamic editing tools, and then statically link when you're
 ready to ship.

I like this.

Yea, me too, actually. :) I'd love to give it a shot sometime. I just love the idea of getting what are admittedly very good benefits from the dynamic/interpreted world without having to give up the benefits of a static natively-compiled systems langauge. I'm a product of the 80's - I want it all, and to hell with making tradeoffs! ;) That's one of the reasons I like D so much in the first place - it's a static natively-compiled systems language that actually *realizes* that anything dynamic/interpreted can do, static/compiled *can* do equally well, if not faster and more robustly (Everyone thinks C/C++/Java when they "static", even though *we* know those are poor examples).
 Speaking of such things, I wonder how hard it would be to port dmd to
 run on another platform? Targeting that platform might be a lot of
 work, but just making it run on it...it *is* written in C++, probably
 the second-most common language in the world (just behind straight C),
 and it's not like it does a bunch direct hardware I/O access, or GUI,
 or anything like that. So I'd imagine mostly just some occasional OS
 calls and assembly. Don't know how much of that there is in there.

What's the point of dmd running on some platform but unable to generate code for it?

Heh, it probably *wouldn't* be very useful unless maybe you wanted to use some supercomputer as a cross-compilation server. I guess what I really meant was: Suppose you're already using D to write, say, a PS3 or Android game, then naturally, at that point, your compiler would already be targeting that platform. So to move from *that* position to letting users mod the game, in-engine, in D, *without* sending the code off to some other computer, you would need two things: 1. Some sort of dynamic-library-like ability on the given platform ('Course, this would be needed even for the "server compilation" method). I have no idea ATM how realistic this is on those platforms, though. 2. Port the compiler to actually run on the given target machine. I'm no expert with the internals of DMD/LDC/GDC, but my suspision is that it would be much easier (at least the front-end anyway) than making a D compiler *target* a different CPU. The one thing I see that probably would give some trouble is the current state of memory-usage during CTFE. (Unless that's yet another thing that's been recently fixed without me realizing?)
 Cross-compiling from your Android to your PC? Sounds a bit
 backwards to me. :-) (Though it might be useful if you're travelling and
 working on code on a portable device.)

Heh :) In that case, I think I'd rather just ssh into my home system. Actually, that's more or less how I think a lot of this "cloud computing" stuff *should* work. Why trust, and maybe even pay subscription money for, internet-accessible space when I *already have* an internet-connected computer with tons of storage right at home? And yea, not everyone has their own reliable static IP right now, but IPv6 will solve that - and in the meantime, I bet a special server could be hacked up to map MAC addresses to an appropriate IPv4 routing path. Or something like that. Of course, that's not to say there aren't very good uses for external hosting. I have a Linode account (recently switched from a shared web host) and I *love* it. The benefits of that sort of thing are - You don't have to spend time or money on hardware upgrades/maintenance. - Your server has a *much* faster/wider better outgoing connection than you'd get with Cable/DSL, and without spending over $1k/month for just a single T1 line. - It's always on, even if you get a lot of power outages you don't need to get another UPS for it, and you don't have to find somewhere to keep it, have it heating up your house, bloating your electric bill, keep pets/kids/clumbsy-guests away from it, worry about transitioning if you move, if something happens to your house the server is still safe, etc. All that stuff is important if, like me, you're running some websites and your own email server. But if you just want to be able to access your data/settings remotely, or share some files, what do you need a webhost, or Flickr, or Twitface, or iCloud for? (And for that matter, Twitface should be a protocol like torrent or Jabber, not a company and a private centralized service) The stuff's already on your computer or other device. Your computer or whatever is already connected to the internet. Boom, right there you should be done. What's with all the middlemen worming their way in?
 [...]
 "The number you have dialed is imaginary. Please rotate your phone
 90 degrees and try again."

I love this one :)

A related one: Life is complex. It consists of real and imaginary parts.

Heh :) Geek humour is awesome. That's part of why I like Futurama so much: Bender (recalling a nightmare): Ones and zeroes everywhere! And I think I saw a two! Fry: Don't worry, Bender. There's no such thing as two. (Or something like that)
Mar 15 2012
prev sibling next sibling parent reply James Miller <james aatch.net> writes:
On 16 March 2012 12:05, Nick Sabalausky <a a.a> wrote:
 "H. S. Teoh" <hsteoh quickfur.ath.cx> wrote in message
 news:mailman.712.1331843803.4860.digitalmars-d puremagic.com...
 On Thu, Mar 15, 2012 at 03:24:24PM -0400, Nick Sabalausky wrote:
 [...]
 - If you can stomach the indent-scoping, Python is very well-regarded
 and has a lot of fancy advanced features.

I used to despise Python's indent-scoping too, though since then I've had some opportunity to use Python for build scripts (google for SCons), and I have to say that it certainly has its own kind of beauty to it. You never have to worry about closing blocks in if statements and the like, for example, and you never have subtle bugs like: auto func(bool x) { int y=0; if (x) y = 1; writeln("x is true"); return y; } But I certainly sympathize with the WAT sentiment when one first learns that Python has indent scoping. :-)

I've used some Python, and I've done a fair amount of SPIN (Parallax's Propeller microcontroller) which also does indent-scoping. Granted, SPIN is a lousy language (the Propeller is awesome though) regardless of its indent-scoping, but still, even the indent-scoping *itself* never ceased being irritating for me, for various different reasons. I do like the indent-scoping in YAML, though. But that's very different: It's optional in YAML and YAML's only a data langauge, not a programming language. As far as SCons, though, I haven't done much with it, but I have looked into it. Even though it techically is Python, I'd argue that its charter leaves it somewhat more similar to YAML than actually writing a whole program in Python.
 [...]
 - If you're looking for the most painful dynamic experince imaginable,
 ActionScript2 should be at the top of your list. Make sure to use
 all-Adobe tools, and the newest versions of each, so the whole
 experience will be *truly* unbearable.

Shouldn't that be ActionScript3?

I've never used ActionScript3. I've heared it's better, but I have no idea how much better. ActionScript2 is truly horrid though. Almost any error that isn't an outright syntax error is *completely* ignored. So if you sneeze wrong near one end of the codebase, then something clear over in another section will just...act wrong, for no apperent reason. I've wasted hours on things like trying to figure out why an image or text wasn't showing up, or was displayed wrong, just becase I declared some *other* object or array and forgot to manually initialize it with a "new MyClass()" or a "new Array()". That's right: you can dereference null, but it isn't an error: it's a no-op that triggers a cascade of no-ops. (And shit, even the heavily-static D lets you declare an array and just start appending to it - and have the data actually *stick* and not be mysteriously gone when you try to read it back.) The API is awful, too. MovieClip, the *foundation* of AS2-based Flash, has got to be the most poorly designed sprite class I've ever seen. When I switched to Haxe, I ended up going to great lengths to wrap MovieClip in a much more sane Sprite class. I think the only way they could have made ActionScript2 worse is if they made it indent-syntax. Ok, and entirely removed what little declaring and type-tagging it does have. And the IDE is wretched. It has one of the most awkward editors I've used, and the bloat...christ, the bloat gets twice as bad with each version, the UI gets more goofily-skinned with each version, and the bloat in CS5 - honest to god - it makes a fully loaded Eclipse seem downright *lean*.
 (And no, I would not touch any of this stuff with a 10-foot pole.)

With ActionScript, ignorance truly is bliss. I'd probably be a happier, [somewhat] less disgruntled man if I'd never needed to use it.

I hate the fact that Flash games are created the way they are. For one, it's impenetrable to try and learn properly, I had so much trouble figuring out how to do things properly, you can attach scripts to almost any object, but sometimes it might be shared over all of the same objects, and other times only on that instance, depending on how you've placed them on the canvas. I probably wrote some terrible code when I started making Flash games, and now Actionscript is so foreign to me that i can barely understand where to start. -- James Miller
Mar 15 2012
parent reply "Nick Sabalausky" <a a.a> writes:
"James Miller" <james aatch.net> wrote in message 
news:mailman.733.1331853568.4860.digitalmars-d puremagic.com...
 I hate the fact that Flash games are created the way they are. For
 one, it's impenetrable to try and learn properly, I had so much
 trouble figuring out how to do things properly, you can attach scripts
 to almost any object, but sometimes it might be shared over all of the
 same objects, and other times only on that instance, depending on how
 you've placed them on the canvas.

 I probably wrote some terrible code when I started making Flash games,
 and now Actionscript is so foreign to me that i can barely understand
 where to start.

Yea, Flash is just plain insane from start to finish. Even the vector/scene-editing GUI is awful. Christ, this is the company that's known for Illustrator: That's the one part of Flash they *should* have been able to get right! (I dunno, maybe the Flash IDE was just drowning in too much MacroMedia legacy?) One thing I learned though, is that if you're going to make something in Flash, your best bet is to use as *little* of what Adobe provides as possible: - Cover any APIs that suck with wrappers that paper over the suck (to the extent possible). - Don't use Flash's "frames" system: Just put your whole program in one "frame", and handle scenes manually by toggling the "_visible" attribute on entire groups of MovieClips. Do animation/tweening by using the timer APIs, a simple "lerp" formula[1], etc, stuff like that. - *Every* piece of ActionScript code embedded into your .fla should be *one* line: #include "realCodeHere.hx"; Store the real code in that *REAL* text file, under proper version control, and edit in a *real* text/code editor. Hell, even if nothing else, at least this make it possible to fucking *diff the files*! (*grumble*Adobe doesn't understand software developement*grumble*) - Abandon ActionScript entirely. Use Haxe instead, and use swfmill to embed assets. Now you don't need to have the Flash IDE even *installed*. Hooray! Every single one of those changes made an order of magnitude improvement for me. Even with the overhead of actually making the switches, it was well worth it: the initial overheads easily paid for themselves in both tangible and intangible ways. [1] A lerp function in Haxe, copied directly from my own production code (consider it "Do what the fuck you want" license), formula derived by just remembering basic high school algebra: class Util { [...] // Convert a value between two scales, using a linear interpolation. // To use as a traditional lerp: Util.lerp(normalizedValue, 0, 1, min, max) // To convert from farenhight to celcius: Util.lerp(degreesF, 32, 212, 0, 100) public static function lerp(fromVal:Float, fromA:Float, fromB:Float, toA:Float, toB:Float):Float { return toA + (fromVal - fromA) * ((toB-toA) / (fromB-fromA)); } [...] }
Mar 15 2012
parent reply Simon <s.d.hammett gmail.com> writes:
On 16/03/2012 02:28, Nick Sabalausky wrote:
 "James Miller"<james aatch.net>  wrote in message
 news:mailman.733.1331853568.4860.digitalmars-d puremagic.com...
 I hate the fact that Flash games are created the way they are. For
 one, it's impenetrable to try and learn properly, I had so much
 trouble figuring out how to do things properly, you can attach scripts
 to almost any object, but sometimes it might be shared over all of the
 same objects, and other times only on that instance, depending on how
 you've placed them on the canvas.

 I probably wrote some terrible code when I started making Flash games,
 and now Actionscript is so foreign to me that i can barely understand
 where to start.


 One thing I learned though, is that if you're going to make something in
 Flash, your best bet is to use as *little* of what Adobe provides as
 possible:

You're being rather unfair to Adobe. It was Macromedia that where the original perpetrators of flash; Adobe brought Macromedia in 2005. I guessing that they only brought Macromedia for the market share rather than because they thought flash was actually any good. I suffered through a module of Flash/Director around 1999. Action script was fecking awful but Director actually wasn't that bad. It was pretty easy to do some neat things so it was easy to see why it was so popular with *web devs* and mouth breathing marketing types. -- My enormous talent is exceeded only by my outrageous laziness. http://www.ssTk.co.uk
Mar 16 2012
parent "Nick Sabalausky" <a a.a> writes:
"Simon" <s.d.hammett gmail.com> wrote in message 
news:jk053b$sg0$1 digitalmars.com...
 On 16/03/2012 02:28, Nick Sabalausky wrote:
 "James Miller"<james aatch.net>  wrote in message
 news:mailman.733.1331853568.4860.digitalmars-d puremagic.com...
 I hate the fact that Flash games are created the way they are. For
 one, it's impenetrable to try and learn properly, I had so much
 trouble figuring out how to do things properly, you can attach scripts
 to almost any object, but sometimes it might be shared over all of the
 same objects, and other times only on that instance, depending on how
 you've placed them on the canvas.

 I probably wrote some terrible code when I started making Flash games,
 and now Actionscript is so foreign to me that i can barely understand
 where to start.


 One thing I learned though, is that if you're going to make something in
 Flash, your best bet is to use as *little* of what Adobe provides as
 possible:

You're being rather unfair to Adobe. It was Macromedia that where the original perpetrators of flash; Adobe brought Macromedia in 2005. I guessing that they only brought Macromedia for the market share rather than because they thought flash was actually any good. I suffered through a module of Flash/Director around 1999. Action script was fecking awful but Director actually wasn't that bad. It was pretty easy to do some neat things so it was easy to see why it was so popular with *web devs* and mouth breathing marketing types.

Well, yea Macromedia created most of it, but Adobe now *provides* it ;) And they did choose to buy it. Anyway though, yea, you're right it is mostly Macromedia. Actually the version I started using was still pre-Adobe: MX 2004. But still, it's been about 6 years and Adobe, well they promtly added AS3 (which like I said, I admit I don't know much about since I haven't used it) and then ever since then they seem to have mostly just added bloat. Again though, you're right, Macromedia's responsible for most of what I hate about Flash (Apperently even Flex is their fault, too. I didn't even know that until I looked it up just now).
Mar 16 2012
prev sibling next sibling parent "so" <so so.so> writes:
On Thursday, 15 March 2012 at 22:51:57 UTC, H. S. Teoh wrote:

 It can also be a security concern. Somebody could offer players 
 an
 "awesome script" in DLL form that actually contains arbitrary 
 exploit
 code. Or a "script" that contains D code for an exploit.

If you are compiling at runtime you can expose only certain header files and with d annotations like "safe" and many others you can also disable low level access.
Mar 16 2012
prev sibling next sibling parent "so" <so so.so> writes:
On Thursday, 15 March 2012 at 22:37:12 UTC, Manu wrote:

 Do you expect users to be modifying the scripts in the retail 
 release?
 Surely scripting is still for what it has always been for, rapid
 iteration/prototyping during development.

You need to be able to do both.
 You only need the compiler as a part of the games 
 asset-pipeline.

That is the biggest and (only :) ) blocker.
Mar 16 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
On Friday, 16 March 2012 at 07:48:19 UTC, so wrote:
 On Thursday, 15 March 2012 at 22:37:12 UTC, Manu wrote:

 Do you expect users to be modifying the scripts in the retail 
 release?
 Surely scripting is still for what it has always been for, 
 rapid
 iteration/prototyping during development.

You need to be able to do both.

There are other (arguably better) ways to do post-release game mods.
 You only need the compiler as a part of the games 
 asset-pipeline.

That is the biggest and (only :) ) blocker.

There's no way around it really. Virtual Machines are technically compilers, to one degree or another. I'd argue that unless the entire engine is written in a interpreted/JITed language, having a compiler *only* as part of the development stage would be best for memory, performance, and file size. Just design the engine in a modularized way and publish libraries (plus tutorials) for a Mod community.
Mar 16 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
Adam D. Ruppe wrote:
 import std.variant;
 struct Extendable {
     Variant[string] properties;
     Variant opDispatch(string name)() {
        return properties[name];
     }
     Variant opDispatch(string name, T)(T t) {
        properties[name] = t;
        return properties[name];
     }
 }

 void main() {
     auto a = Extendable();
     a.sweet = 10;
     a.cool = { a.sweet = a.sweet + 1; } // could probably fix 
 ++ too..
     // fails with std.variant but the language *could* do it
     a.cool(); // exercise for the reader: maek this work! Gotta 
 add opCall.
 }

Alright I give up dammit! How do you use opCall() to make a.cool() work?
Mar 16 2012
prev sibling next sibling parent "Boscop" <nospam example.com> writes:
On Friday, 16 March 2012 at 09:12:57 UTC, F i L wrote:
 Alright I give up dammit! How do you use opCall() to make 
 a.cool() work?

How would it be possible, the type of the delegate can't be typechecked at the call-site, because the type info is lost in the variant. And you can't exhaustively test for all function types in the opDispatch getter. opDispatch would have to store the names and types internally at compile-time, which isn't possible. But even then it would have to be guaranteed that all setter calls are evaluated before the getter calls are checked. Maybe one could manually store the type info in a special struct together with the delegate and then cast it to that type in the opDispatch getter.
Mar 16 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 16 March 2012 at 09:12:57 UTC, F i L wrote:
 Alright I give up dammit! How do you use opCall() to make 
 a.cool() work?

I was a little unclear... but you'll have to modify std.variant and/or wrap it. Here's a solution that wraps it: == import std.traits; import std.variant; // we want to give a common interface to all functions, // which is what this wrapper tries to do. // note it is kinda buggy; this is just a quick example, // not a finished product Variant delegate(Variant[]) wrap(alias t)() { return delegate Variant(Variant[] args) { ParameterTypeTuple!(typeof(t)) ptt; foreach(i, param; ptt) { if(i == args.length) break; // or throw if you want strictness // BTW, you can do default params and names too, // but it takes a fair amount of code. Check // out my web.d generateWrapper() for this if // you are interested. // or get for strictness ptt[i] = args[i].coerce!(typeof(param)); } Variant returned; static if(is(ReturnType!(typeof(t)) == void)) t(ptt); else returned = t(ptt); return returned; }; } // here's our variant wrapper... struct MyVariant { Variant delegate(Variant[]) callable; Variant value; alias value this; // the main trick here is when we construct or assign, // we have compile time info about the function. So, we // use this opportunity to build a delegate to call it dynamically. this(T)(T t) { value = t; static if(isCallable!T) { callable = wrap!(t)(); } else { callable = null; } } // and here, we use the delegate made above Variant opCall(T...)(T t) { if(!callable) throw new Exception("not callable"); Variant[] args; foreach(i, v; t) args ~= Variant(v); return callable(args); } MyVariant opAssign(T)(T t) { // FIXME: copy/paste from constructor because otherwise it // tries to call a simple delegate instead of passing the delegate itself.. value = t; static if(isCallable!T) { callable = wrap!(t)(); } else { callable = null; } return this; } } // let's test it import std.stdio; void main () { MyVariant v = 10; //v(); // would throw v = { writefln("Hello, world!"); }; v(); // says hello! } == One of the big bugs is that the compile conflates instance opCall, static opCall, and constructors in such a way that it sometimes calls the wrong one. This makes calling things with parameters a pain in the ass, and I hope dmd eventually fixes this. For instance, add this to the end: v = function(int a) { writeln("whoa: ", a); }; v(10); And the stupid compiler thinks v(10) is calling the struct's constructor again. Why would you /ever/ want that on an instance? It also complains if you declare opCall and static opCall separately. Why? You can work around this by making MyVariant a class. No constructor (that apparently doesn't work right either. This is bug city!), just opAssign. Then you can do: == auto v = new MyVariant(); v = { writefln("Hello, world!"); }; v(); // says hello v = function(int a) { writeln("whoa: ", a); }; v(10); // says whoa: 10 // look, a std.variant bug too while we're at it // fix this in std.variant tho, and it will work too // v("12"); // Type immutable(char)[] does not convert to int == This isn't something I use every day, but even in bug city, it isn't /too/ hard to make it work in D, including weak typing and variable argument lists, just like Javascript if we want to. Or, we can go tougher with minor changes. D rox despite bugs.
Mar 16 2012
prev sibling next sibling parent "F i L" <witte2008 gmail.com> writes:
On Friday, 16 March 2012 at 14:23:20 UTC, Adam D. Ruppe wrote:
 On Friday, 16 March 2012 at 09:12:57 UTC, F i L wrote:
 Alright I give up dammit! How do you use opCall() to make 
 a.cool() work?

I was a little unclear... but you'll have to modify std.variant and/or wrap it. Here's a solution that wraps it: [snip]

Thank you for all the code. :)
 D rox despite bugs.

Yes it does. I'm sure it wont be too long before all this stuff is fixed up a bit.
Mar 16 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 16 March 2012 at 22:48:44 UTC, F i L wrote:
 Yes it does. I'm sure it wont be too long before all this stuff 
 is fixed up a bit.

Aye. I just sent a pull request for the minor std.variant thing (so strings can be converted to ints - we can do weak typing more easily now if we want). The opCall stuff is probably a lot harder to fix. Much of it is legacy from D1 I think. But it is pretty usable today, anyway. Use the class and assignment operator and it works well. The biggest annoyance is that property doesn't work right (not even with -property). So, if you merge this with the opDispatch code from an earlier post, you can do: a.myProperty = { writeln("hello!"); } a.myProperty(); // does nothing because it thinks you are doing the getter... a.myProperty()(); // this work. first paren does get, second does call.
Mar 16 2012
prev sibling next sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 16 March 2012 at 11:22:07 UTC, Boscop wrote:
 How would it be possible, the type of the delegate can't be 
 typechecked at the call-site, because the type info is lost in 
 the variant.

The trick is to build wrapper functions at the assignment point, where you still have all the type info. I showed that with the wrap() template in the implementation in a previous post - std.traits.ReturnType and std.traits.ParameterTypeTuple help a lot there. This same technique can do all kinds of conversions: I use it to do strings -> calls for web apps and Variant -> calls for this dynamic thing, weak typing, and script interaction. Remember, that while the wrapper is showed at the assignment type, it is a compile time thing to build the wrapper, so the assignment is still cheap. The call has a small runtime hit though, since it does the type conversions or checks there. If you wanted strict type checking, it could probably be fast; Variant.get() has a small cost.
Mar 16 2012
prev sibling next sibling parent bearophile <bearophileHUGS lycos.com> writes:
so:

 Not related to D but this is a community which i can find at 
 least a few objective person. I want to invest some "quality" 
 time on a dynamic language but i am not sure which one. Would you 
 please suggest one?
 
 To give you an idea what i am after:
 Of all one-liners i have heard only one gets me.
 "The programmable programming language". Is it true? If so Lisp 
 will be my first choice.

There are several dynamic languages available, and different ones are better for different purposes. The general purpose dynamic language that I suggest is Python, because it's very readable, it's very handy to write prototypes in, it allows a low bug count, it's widespread and you can find all kind of libs for it. Lua is better for interfacing with C, and the small size makes it good to write the logic for games, and its JIT is the best. Clojure seems nice for low-performance parallel code. It's a bug un-prone language. Qi and its derivatives have the most powerful type system. Bye, bearophile
Mar 16 2012
prev sibling parent Danni Coy <danni.coy gmail.com> writes:
--e89a8f83ab7d29bd8d04bb69af60
Content-Type: text/plain; charset=ISO-8859-1

I mostly do game scripting -- and there are quite a few features in D that
I would like access to.

Python would be my goto dynamic language mostly because a lot of the
applications I use are either partially written in it or can be scripted
easily using it. Also it is quite an enjoyable language to use when
performance isn't your primary concern. It escapes back to C quite
efficiently though which I think is one of the main reasons it is so widely
used.

I also like Perl (though I haven't actually needed to use it for many years
now) for it's expressiveness.

The other dynamic language I would concider quite useful is javascript and
not just for web.

That being said I generally choose the task first and the language second.
D is perhaps the second time I have learned a language for the fun of it.

On Fri, Mar 16, 2012 at 5:15 AM, Manu <turkeyman gmail.com> wrote:

 On 15 March 2012 20:59, so <so so.so> wrote:

 Thank you all!


 On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:

 On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:

 If so Lisp will be my first choice.

I just talked about D because D rox, but if you are doing it for education, Lisp is a good choice because it is fairly unique.

I'd love to use D but it is not an option is it? At least for the things i am after, say game scripting.

I dunno, that sounds like a pretty interesting idea to me! :)

--e89a8f83ab7d29bd8d04bb69af60 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I mostly do game scripting -- and there are quite a few features in D that = I would like access to.<div><br></div><div>Python would be my goto dynamic = language mostly because a lot of the applications I use are either partiall= y written in it or can be scripted easily using it. Also it is quite an enj= oyable language to use when performance isn&#39;t your primary concern. It = escapes back to C quite efficiently though which I think is one of the main= reasons it is so widely used.</div> <div><br></div><div>I also like Perl (though I haven&#39;t actually needed = to use it for many years now) for it&#39;s expressiveness.=A0</div><div><br=
</div><div>The other dynamic language I would concider quite useful is jav=

<div><br></div><div>That being said I generally choose the task first and t= he language second. D is perhaps the second time I have learned a language = for the fun of it.<br><br><div class=3D"gmail_quote">On Fri, Mar 16, 2012 a= t 5:15 AM, Manu <span dir=3D"ltr">&lt;<a href=3D"mailto:turkeyman gmail.com= ">turkeyman gmail.com</a>&gt;</span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"><div class=3D"gmail_quote"><div class=3D"im"=
On 15 March 2012 20:59, so <span dir=3D"ltr">&lt;so so.so&gt;</span> wrote=

ft:1px #ccc solid;padding-left:1ex"> Thank you all!<div> <br> <br> On Thursday, 15 March 2012 at 17:30:49 UTC, Adam D. Ruppe wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> On Thursday, 15 March 2012 at 07:09:39 UTC, so wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex"> If so Lisp will be my first choice.<br> </blockquote> <br> I just talked about D because D rox, but if you are doing<br> it for education, Lisp is a good choice because it is fairly<br> unique.<br> </blockquote> <br></div> I&#39;d love to use D but it is not an option is it? At least for the thing= s i am after, say game scripting.</blockquote><div><br></div></div><div>I d= unno, that sounds like a pretty interesting idea to me! :)</div></div> </blockquote></div><br></div> --e89a8f83ab7d29bd8d04bb69af60--
Mar 16 2012