www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Language Subsets

reply =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim gmail.com> writes:
--e89a8ff24babbd1b0004bdc7c7ba
Content-Type: text/plain; charset=UTF-8

Hi,

I'd like to have more informations about the subsets of D.
My current understanding is that D have at least one subset that is called
SafeD, I m reading that article about it right now:
http://dlang.org/safed.html
I first thought there was only SafeD but in a recent video from Lang.Next
mr Alexandrescu says there are several layers or something similar.
Am I correct?

Also, I would like to find a page on the website that list clearly what is
in each subset. I couldn t find it so far but maybe I m not using the right
words to search.


Thanks

Klaim / Joel Lamotte

--e89a8ff24babbd1b0004bdc7c7ba
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,<div><br></div><div>I&#39;d like to have more informations about the sub=
sets of D.</div><div>My current understanding is that D have at least one s=
ubset that is called SafeD, I m reading that article about it right now:=C2=
=A0<a href=3D"http://dlang.org/safed.html">http://dlang.org/safed.html</a><=
/div>
<div>I first thought there was only SafeD but in a recent video from Lang.N=
ext mr Alexandrescu says there are several layers or something similar.</di=
v><div>Am I correct?</div><div><br></div><div>Also, I would like to find a =
page on the website that list clearly what is in each subset. I couldn t fi=
nd it so far but maybe I m not using the right words to search.</div>
<div><br></div><div><br></div><div>Thanks</div><div><br></div><div>Klaim / =
Joel Lamotte</div><div><br></div>

--e89a8ff24babbd1b0004bdc7c7ba--
Apr 16 2012
next sibling parent deadalnix <deadalnix gmail.com> writes:
Le 16/04/2012 10:40, Klaim - Joël Lamotte a écrit :
 Hi,

 I'd like to have more informations about the subsets of D.
 My current understanding is that D have at least one subset that is
 called SafeD, I m reading that article about it right now:
 http://dlang.org/safed.html
 I first thought there was only SafeD but in a recent video from
 Lang.Next mr Alexandrescu says there are several layers or something
 similar.
 Am I correct?

 Also, I would like to find a page on the website that list clearly what
 is in each subset. I couldn t find it so far but maybe I m not using the
 right words to search.


 Thanks

 Klaim / Joel Lamotte

safe only allow operation that cannot screw up your memory. system is the complete language. trusted is an explicit qualifie, to allow safe code to call system code. It is mandatory, for instance, for safe code to call the GC (GC code cannot be safe). It is up to the develloper to ensure that trusted code can really be trusted, so it isn't a subset.
Apr 16 2012
prev sibling next sibling parent =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim gmail.com> writes:
--047d7b10cb5122375b04bdc8306b
Content-Type: text/plain; charset=UTF-8

On Mon, Apr 16, 2012 at 17:53, deadalnix <deadalnix gmail.com> wrote:

  safe only allow operation that cannot screw up your memory.  system is
 the complete language.

  trusted is an explicit qualifie, to allow  safe code to call  system
 code. It is mandatory, for instance, for  safe code to call the GC (GC code
 cannot be  safe).

 It is up to the develloper to ensure that  trusted code can really be
 trusted, so it isn't a subset.

Thanks, it helps a bit. However, a clear list of feature -> subset would be far more useful for me. Klaim / Joel Lamotte --047d7b10cb5122375b04bdc8306b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <br><br><div class=3D"gmail_quote">On Mon, Apr 16, 2012 at 17:53, deadalnix= <span dir=3D"ltr">&lt;<a href=3D"mailto:deadalnix gmail.com">deadalnix gma= il.com</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><div class=3D"h5"><br></div></div> safe only allow operation that cannot screw up your memory. system is the= complete language.<br> <br> trusted is an explicit qualifie, to allow safe code to call system code.= It is mandatory, for instance, for safe code to call the GC (GC code cann= ot be safe).<br> <br> It is up to the develloper to ensure that trusted code can really be trust= ed, so it isn&#39;t a subset.<br> </blockquote></div><br><div><br></div><div>Thanks, it helps a bit.</div><di= v>However, a clear list of feature -&gt; subset would be far more useful fo= r me.</div><div><br></div><div>Klaim / Joel Lamotte</div> --047d7b10cb5122375b04bdc8306b--
Apr 16 2012
prev sibling next sibling parent Marco Leise <Marco.Leise gmx.de> writes:
Am Mon, 16 Apr 2012 18:10:05 +0900
schrieb Klaim - Jo=C3=ABl Lamotte <mjklaim gmail.com>:

 On Mon, Apr 16, 2012 at 17:53, deadalnix <deadalnix gmail.com> wrote:
=20
  safe only allow operation that cannot screw up your memory.  system is
 the complete language.

  trusted is an explicit qualifie, to allow  safe code to call  system
 code. It is mandatory, for instance, for  safe code to call the GC (GC =


 cannot be  safe).

 It is up to the develloper to ensure that  trusted code can really be
 trusted, so it isn't a subset.

=20 Thanks, it helps a bit. However, a clear list of feature -> subset would be far more useful for m=

=20
 Klaim / Joel Lamotte

Since noone answered, I don't know what you heard in the video, but from my= experience safe is the only real subset that exists. And for you as the d= eveloper it means, that you can not use I/O and operations on pointers. Als= o when compiling in -release mode safe keeps array bounds checks, while s= ystem drops those checks. I imagine safe code as encapsulated. It cannot t= alk to the outside world or access unrelated parts through pointer arithmet= ic. (Although, you can always call trusted code which in turn calls syste= m code.) It's probably comparable to programming in a VM language like Java= . You can apply safe to either single functions or right at the top of you= r module to cover all code like so: " safe:". A feature table of safe/ system is probably overkill, since most features = still work. You just lose ASM/pointer arithmetics and direct calls to syst= em functions (which is the default). Work is on the way to mark as much of = Phobos safe as possible, since some functions still miss that attribute. --=20 Marco
Apr 21 2012
prev sibling parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Saturday, 21 April 2012 at 15:33:08 UTC, Marco Leise wrote:
 Since noone answered, I don't know what you heard in the video, 
 but from my experience  safe is the only real subset that 
 exists. And for you as the developer it means, that you can not 
 use I/O and operations on pointers. Also when compiling in 
 -release mode  safe keeps array bounds checks, while  system 
 drops those checks. I imagine  safe code as encapsulated. It 
 cannot talk to the outside world or access unrelated parts 
 through pointer arithmetic. (Although, you can always call 
  trusted code which in turn calls  system code.) It's probably 
 comparable to programming in a VM language like Java. You can 
 apply  safe to either single functions or right at the top of 
 your module to cover all code like so: " safe:".

 A feature table of  safe/ system is probably overkill, since 
 most features still work. You just lose ASM/pointer arithmetics 
 and direct calls to  system functions (which is the default). 
 Work is on the way to mark as much of Phobos  safe as possible, 
 since some functions still miss that attribute.

There is a list at: http://dlang.org/function.html#function-safety And a separate, apparently less-maintained list at: http://dlang.org/memory-safe-d.html Phobos' I/O routines are trusted, hence you can use them in SafeD. SafeD is the only defined language subset of D that the specification and compiler deal with.
Apr 21 2012