Re: [julia-users] Is Julia a safe language? Including exception handling?

2015-01-07 Thread Páll Haraldsson

Thanks for answering (and to others automatically, I refrain from answering 
thank you with no other comments..). That was an interesting thread I 
might comment on.. Maybe there or here (relates a bit to exception 
handling, so not sure which one to choose).

I knew Julia wasn't safe (at least depending on how I define it). What I 
really meant (to ask) can it be made safe - easily.

I know getindex, and saw unsafe_getindex in another thread. I assume it 
does the same, without bounds checking (locally). There is also a switch:

--check-bounds={yes|no}  Emit bounds checks always or never (ignoring 
declarations)

It can't be found in the documentation but it seems the default is 
inbetween not either option. [And I can assume that default applies to the 
benchmarks on julialang.org?]

I assume the option redirects unsafe_getindex to getindex if the switch is 
set. Could something similar be done in other cases, such as disable ccall, 
from within code, or if you do not want to trust the programmer by adding a 
switch? Possibly excluding ccall in vetted (Base.*) code? An unsafe keyword 
needed?

I'm trying to find out how unsafe Julia is/how broken it will be if things 
are disabled. Anything else you can think of? For me, BLAS, Fortran calling 
etc. being out could potentially be ok..

-- 
Palli.


On Sunday, January 4, 2015 2:59:38 PM UTC, Tamas Papp wrote:

 On Sun, Jan 04 2015, Páll Haraldsson pall.ha...@gmail.com javascript: 
 wrote: 

  Another issue I saw, uninitialized variables. Rust and others disallow, 
 I 
  think Julia does too (or easily could) except when constructing arrays 
  (because of speed I guess). Wouldn't that be easily fixed? If similar() 
  would zero-initialized. Maybe a command-line option for Julia? [Haven't 
  looked to closely at pointers, at least not common to make arrays of 
  pointers..] 

 This was discussed very recently. See the thread here: 

 http://thread.gmane.org/gmane.comp.lang.julia.user/24227/ 

 Best, 

 Tamas 



[julia-users] Is Julia a safe language? Including exception handling?

2015-01-04 Thread Páll Haraldsson

Hi,

First, for the intended users of Julia (and lots more), it seems to me 
exception handling is the way to go. You would much rather have your 
program stop with unhandled exception than the alternative, unchecked 
return code (as in C), and get wrong answers.

I've been thinking about how you can continue after an exception and that 
you probably can't in general.. and then saw this:

https://en.wikipedia.org/wiki/Exception_handling

Exception handling is commonly not resumable in those languages


I'm not sure what other languages, say Erlang, do. Could Julia never work 
for similiar things? Or are whole sub-systems just restarted?

If you get an exception in a function that mutates an array it seems there 
is nothing the caller can do.. But probably bad in most other languages. 
Not sure if this is one reason some other languages are pure functional.


Another issue I saw, uninitialized variables. Rust and others disallow, I 
think Julia does too (or easily could) except when constructing arrays 
(because of speed I guess). Wouldn't that be easily fixed? If similar() 
would zero-initialized. Maybe a command-line option for Julia? [Haven't 
looked to closely at pointers, at least not common to make arrays of 
pointers..]

Some languages have an unsafe subset, is that needed for Julia? I view 
ccall as an unsafe keyword, maybe the rest is safe.. except for the above?

-- 
Palli.



Re: [julia-users] Is Julia a safe language? Including exception handling?

2015-01-04 Thread Tamas Papp
On Sun, Jan 04 2015, Páll Haraldsson pall.haralds...@gmail.com wrote:

 Another issue I saw, uninitialized variables. Rust and others disallow, I
 think Julia does too (or easily could) except when constructing arrays
 (because of speed I guess). Wouldn't that be easily fixed? If similar()
 would zero-initialized. Maybe a command-line option for Julia? [Haven't
 looked to closely at pointers, at least not common to make arrays of
 pointers..]

This was discussed very recently. See the thread here:

http://thread.gmane.org/gmane.comp.lang.julia.user/24227/

Best,

Tamas