Re: My thoughts on C# and gaming.

OvermindDL1 <[email protected]>
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
On Wed, Jan 27, 2010 at 7:45 PM, Bill Kelly <[email protected]> wrote:
> Emil Dotchevski wrote:
>> On Wed, Jan 27, 2010 at 2:00 PM, Bill Kelly <[email protected]> wrote:
>>> Emil Dotchevski wrote:
>>>> On Wed, Jan 27, 2010 at 2:26 AM, Bill Kelly <[email protected]> wrote:
>>>>>> Being able to do things like this is not what makes a language great.
>>>>>> In fact I am not sure what makes most languages great. It seems to me
>>>>>> that most languages should have been a C++ library or a LISP library
>>>>>> instead -- all other differences are primarily syntactical in nature
>>>>>> and thus not very interesting as far as I am concerned.
>>> An example of a Ruby DSL, in this case an assembler for Common
>>> Intermediate Language bytecode:
>>>
>>>  http://www.iunknown.com/2005/12/refining-the-ru.html
>>>
>>>   require 'RbDynamicMethod'
>>>
>>>   RbDynamicMethod::create_ruby_method('say_hello') do
>>>     include  'System, System.Collections'
>>>     ldstr    'Hello, World, int = {0}, double = {1}'
>>>     ldc_i4   42
>>>     box      'Int32'
>>>     ldc_r8   3.141592654
>>>     box      'Double'
>>>     call     'static Console.WriteLine(String,Object,Object)'
>>>     br_s     'end_of_method'
>>>     ldstr    'Goodbye, World'
>>>     call     'static Console.WriteLine(String)'
>>>     label    'end_of_method'
>>>     ldc_i4_4
>>>     ret
>>>   end
>>
>> Compare such VM design to the simplicity of a LISP interpreter. LISP
>> is not just the grandfather of all dynamic languages, it is the most
>> basic and most powerful of the bunch.
>>
>> C++ is similarly basic and powerful in the "static type checking"
>> domain. In fact it is C++ that introduced the concept to begin with,
>> only later it was adopted by C.
>
> I apologize if we are talking at cross-purposes or if I have been
> unclear in conveying my point.
>
> In posting the above Ruby DSL, I was attempting to respond to
> your statement, "all other differences are primarily syntactical
> in nature and thus not very interesting as far as I am concerned."
>
> As cool as Lisp is--which I have gleaned more from reading about
> its design than from my meager experience with the language so far--
> my understanding is that Lisp syntax won't allow an uncluttered
> DSL like the above to be parsed *as Lisp*.
>
> Ruby syntax, on the other hand, is flexible enough to parse the
> above *as Ruby*.
>
> As such, it is relatively common for Ruby programmers to create
> so-called internal DSLs rather than external DSLs, when the intent
> is simply to bring the programming language itself closer to the
> problem domain.  (Obviously if the DSL is intended to be edited by
> an untrusted user, than an internal DSL would be a poor choice.)
>
> At the risk of belaboring the point, my argument is that Ruby's
> syntactical flexibility is useful, and as far as I know, can't
> readily be mimicked by the other languages we've been discussing.

Actually, with read-macros in LISP, you can make LISP look like
anything, so you could probably change:
  p ARGF.read.scan(/\d{1,3}(\.\d{1,3}){3}/).uniq.size
Into a Lisp version of something like:
 #Ruby p ARGF.read.scan(/\d{1,3}(\.\d{1,3}){3}/).uniq.size

Lisp can literally become anything.  The combination of macros and
read-macros are insanely powerful.  The D language comes pretty close
to that power (although not completely) with its string templates and
mixin support.  You can quite *literally* make a Ruby parser embedded
in Lisp in such a way that you can freely mix both.
_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.