Zimbu

Iain Buclaw ibuclaw at ubuntu.com
Sat Sep 14 16:05:47 PDT 2013


On 14 September 2013 22:58, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:
> On Sat, Sep 14, 2013 at 08:04:10PM +0100, Iain Buclaw wrote:
>> On 14 September 2013 19:47, Nick Sabalausky
>> <SeeWebsiteToContactMe at semitwist.com> wrote:
>> > On Sat, 14 Sep 2013 13:14:09 +0200
>> > Joseph Rushton Wakeling <joseph.wakeling at webdrake.net> wrote:
>> >
>> >> On 14/09/13 00:51, Justin Whear wrote:
>> >> > Just ran across this: http://www.zimbu.org/
>> >> > A language by Bram Moolenaar (original author and maintainer of
>> >> > vim). The "Why Zimbu?" section on the right side of the homepage
>> >> > has comparisons to other languages.  D is the last comparison,
>> >> > suggesting that it meets all the other qualifications but fails
>> >> > on "It has to run on most systems, anything with a C compiler, so
>> >> > D is out."
>> >>
>> >> Theoretically, shouldn't GDC be able to support just about any
>> >> architecture for which GCC has a backend?  The runtime and Phobos
>> >> need porting, but the core language itself should be usable, no?
>> >
>> > And doesn't LLVM have a way to compile D *to* C?
>> >
>>
>> If it did, there would be quite a few bits missing as much of D can
>> not be easily represented in C.
> [...]
>
> Really? Example? I thought *anything* can be reduced to C, given enough
> implementational abstractions.
>
>
> T
>
> --
> What do you mean the Internet isn't filled with subliminal messages? What about all those buttons marked "submit"??

Exceptions are one such example.  In gcc codegen, they are reduced to
essentially:

trybody:
  Array __tmp1 = { .length = 5, .ptr = "foo.c"; };
  Array __tmp2 = { .length = 3, .ptr = "Die"; };
  Object & o = _d_newclass (&_D9Exception7__ClassZ);

  Exception & _e = __ctor (o, __tmp2, __tmp1, 8, 0);
  _d_throw (e);

finally:
  return 0;

  int ehf = __builtin_eh_filter (1);
  switch (ehf)
    {
    case 1:
      goto catchbody;
    default:
      goto catch;
    }

catch:
  void * ehp = __builtin_eh_pointer (1);
  __builtin_unwind_resume (ehp;

catchbody:
  o = *(__builtin_eh_pointer (1) + 18446744073709551608);
  e = _d_dynamic_cast (o, &_D9Exception7__ClassZ);
  goto finally;
}


Which doesn't have any natural flow between eh_filter() and _d_throw().

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list