It seems what he is saying about C++ are generic challenges that are not
unique to C++. For example:
What happens in ATS if malloc returns null pointer (insufficient
memory)? For nonlinear types I assume that would lead to null pointer
dereference down the line. For linear types it would be like C, depending
on how much effort you want to spend on modelling such behavior?
Are exceptions safe in ATS? Here does manually managing memory with
linear types work with exceptions? AFAIK longjmp/setjmp only unwind
alloca-ed memories so I don’t see how one does it with standard C. For
nonlinear types you don’t worry about it but that is due to GC.
Based on my use of exceptions, they are save insofar as they can be
expected to be (expressions using them are still required to return the
appropriate type, but of course if an exception is called this will not
actually happen dynamically.
Linear types and exceptions can be used in the same program, but it is not
necessarily resource safe (for the linear resources) to do so. I believe
there may be some restrictions as to where exceptions can be used with
regard to linear types as well, but don’t quote me on that.
Concurrency problem with shared memory is not unique to C++. It does
not matter what language you use.
GC is not composable, in the sense that if C++ depends on GC then you
can’t use it to write low level libraries without bringing in the
dependence on GC. So in the end you force everyone to either use the same
managed run time or not use your language. It is interesting that for
compiled languages with GC dependence only the ones targeting common
managed runtimes (JVM or CLR) get popular. Python/Ruby/Lua are all dynamic
languages that come with a complete environment with robust REPL support.
I always sort of assumed the JVM and CLR were popular because of their
industry support and extensive libraries. In the same way, C/C++ are
popular because of their immense libraries (and industry support, and yes,
also speed).
A call to malloc in ATS does not return null; it aborts if there is no
sufficient memory available.On Tuesday, March 25, 2014 12:34:00 PM UTC-4, H Zhang wrote:
It seems what he is saying about C++ are generic challenges that are not
unique to C++. For example:
What happens in ATS if malloc returns null pointer (insufficient
memory)? For nonlinear types I assume that would lead to null pointer
dereference down the line. For linear types it would be like C, depending
on how much effort you want to spend on modelling such behavior?
Are exceptions safe in ATS? Here does manually managing memory with
linear types work with exceptions? AFAIK longjmp/setjmp only unwind
alloca-ed memories so I don’t see how one does it with standard C. For
nonlinear types you don’t worry about it but that is due to GC.
Concurrency problem with shared memory is not unique to C++. It does
not matter what language you use.
GC is not composable, in the sense that if C++ depends on GC then you
can’t use it to write low level libraries without bringing in the
dependence on GC. So in the end you force everyone to either use the same
managed run time or not use your language. It is interesting that for
compiled languages with GC dependence only the ones targeting common
managed runtimes (JVM or CLR) get popular. Python/Ruby/Lua are all dynamic
languages that come with a complete environment with robust REPL support.
Haitao
On Monday, March 24, 2014 8:55:32 PM UTC-7, gmhwxi wrote:
It seems what he is saying about C++ are generic challenges that are not
unique to C++. For example:
What happens in ATS if malloc returns null pointer (insufficient
memory)? For nonlinear types I assume that would lead to null pointer
dereference down the line. For linear types it would be like C, depending
on how much effort you want to spend on modelling such behavior?
Are exceptions safe in ATS? Here does manually managing memory with
linear types work with exceptions? AFAIK longjmp/setjmp only unwind
alloca-ed memories so I don’t see how one does it with standard C. For
nonlinear types you don’t worry about it but that is due to GC.
Concurrency problem with shared memory is not unique to C++. It does not
matter what language you use.
GC is not composable, in the sense that if C++ depends on GC then you
can’t use it to write low level libraries without bringing in the
dependence on GC. So in the end you force everyone to either use the same
managed run time or not use your language. It is interesting that for
compiled languages with GC dependence only the ones targeting common
managed runtimes (JVM or CLR) get popular. Python/Ruby/Lua are all dynamic
languages that come with a complete environment with robust REPL support.
HaitaoOn Monday, March 24, 2014 8:55:32 PM UTC-7, gmhwxi wrote: