[rust-dev] HasField

2012-05-20 Thread Bennie Kloosteman
New member to the list im no genius but am looking for a replacement for c for system programming. 1) Great work on UTF8 strings and USC4 chars ( I do some work with chinese chars and USC-2 just doesn't work here) . BTW why null terminated strings if you have arrays . Any c interop will require

Re: [rust-dev] Back to errors, failures and exceptions

2012-05-21 Thread Bennie Kloosteman
Are exceptions a good model for systems programming ? - legacy C programs cant call you without a wrapper which translates all possible exceptions - unwinding a stack is probably not a good idea in a kernel or when you transition into protected/user mode.( I know of very few kernels that use excep

[rust-dev] HasField

2012-05-21 Thread Bennie Kloosteman
recover from errors) . Since all requests were asynchronous system wide hotspots could get additional resources. Anyway you can see my interest in Rust though your tasks are more fine grained. On Mon, May 21, 2012 at 12:06 AM, Patrick Walton wrote: > On 05/20/2012 05:23 AM, Bennie Kloosteman wr

[rust-dev] Back to errors, failures and exceptions

2012-05-25 Thread Bennie Kloosteman
On Thu, May 24, 2012 at 9:16 PM, David Rajchenbach-Teller wrote: > On 5/24/12 12:40 PM, Bennie Kloosteman wrote: >>> * The system _must_ not prevent developers from calling C code from Rust. >>> * The system _must_ not prevent developers from passing a pointer to a >&g

[rust-dev] Eliminating Bounds checks on arrays

2012-05-25 Thread Bennie Kloosteman
Does Rust have bounds checking on arrays ? I was on the bitc list and Shap suggested rather than javas complicated ( and expensive from an engineering point of view) bounds checking elimination in a Haskell typesystem you can use a Natural number 1:N kind for the length. This is a really cool tech

Re: [rust-dev] Back to errors, failures and exceptions

2012-05-25 Thread Bennie Kloosteman
I thought Rust was not going to implement C++ style exceptions . are these scopes not very similar ? Do you unwind the stack etc when you are nested deeply within a scope and a fail occurs ? Also more importantly can you safely handle tasks that were created in the now to be unwound scopes ?

[rust-dev] Back to errors, failures and exceptions

2012-05-29 Thread Bennie Kloosteman
> > In general it seems there are three classes of errors > >    - globally unrecoverable (just call `fail`) >    - locally unrecoverable (return a `result` type) >    - recoverable (pass in handler or error reporter) > > Globally unrecoverable means that the whole task cannot continue (this is > c

[rust-dev] a vision for vectors

2012-06-13 Thread Bennie Kloosteman
fwd > > > On 6/13/12 7:50 PM, Bennie Kloosteman wrote: > > let mut v = []; > for some loop { v += [elt]; } > > Now, often, such loops can (and should) be written using a higher-order > function (e.g., map, filter). But sometimes not. In such cases, under the > new

Re: [rust-dev] Getter and setters

2012-07-22 Thread Bennie Kloosteman
There are no real cons..it gets compiled out. The big pros to me are put a break point on them and access control ( which can be different between read and write) . However I'm not sure how to do private field / public property ( get function) in Rust . Ben On Sun, Jul 22, 2012 at 7:15 PM, Davi

Re: [rust-dev] Getter and setters

2012-07-22 Thread Bennie Kloosteman
> > As for getters and setters, I've thought about them, but I'm really > inclined to say YAGNI here. C# added them, and they actually accrued a lot > of complexity over time (autogenerated getters and setters, etc). You can > pretty easily make a function opts() and set_opts(). Our complexity budg

Re: [rust-dev] Rust philosophy and OOP

2012-10-08 Thread Bennie Kloosteman
Multiple parameter are very useful eg a collection and a second type , but it gets messy... it works ok provided its in a single compilation unit but else you get compilation unit dependency loops ,with generics ( which are similar) you can auto generate new libs to handle this not sure about

Re: [rust-dev] Rust philosophy and OOP

2012-10-10 Thread Bennie Kloosteman
> > > 2. This discussion is getting a bit far from specifics of how to > improve Rust. Please take it elsewhere. If there is interest, we may > start a rust-cafe list in the vein of haskell-cafe for off-topic-ish > discussions (or, in fact, anybody could, on Google Groups). But for > now, please tr

Re: [rust-dev] Rust philosophy and OOP

2012-10-10 Thread Bennie Kloosteman
Niko , what about the performance of these polymorphic functions ? Even C++ virtual calls bite when you have calls to a different compilation unit compared to a good java run time ( mainly due to polymorphic inline caches). And how do you handle module traits there are some nasty issue here with H

Re: [rust-dev] Rust philosophy and OOP

2012-10-11 Thread Bennie Kloosteman
On Thu, Oct 11, 2012 at 9:20 PM, Niko Matsakis wrote: > > You are correct that using a virtual table does incur some runtime cost. > > That's one of the reasons we chose to offer the option of using bounded > generics as an alternative, since (due to monomorphization) this implies no > vtable.

Re: [rust-dev] RFC: All extern "C" functions are unsafe

2012-10-15 Thread Bennie Kloosteman
I think its quite important especially when you get 100K to 1M line projects knowing what is safe .. Nothing more annoying that c Heisenbugs some which took a decade to track down . If the c lib is mature people will write wrappers and with a bit of luck eventually the wrappers may mature into sa

[rust-dev] Fwd: IsRustSlimYet (IsRustFastYet v2)

2013-07-04 Thread Bennie Kloosteman
Still the cost is 10* and the stack is only 2* part of it..so there are bigger issues . Speaking of stacks sIngularity used segmented stacks..and it did not give a big issues ( and that is for the whole OS) .. maybe someone should have a closer look. Here is a quote . Note the compiler analysis t

Re: [rust-dev] Segmented stacks

2013-07-07 Thread Bennie Kloosteman
"You think Linux is not well-engineered?" Nope .. its the same piece of 1970s crap that all the other popular OS use , with trivial differences people make a bit deal about.. You really think the difference between Vista and Linux is the kernel when you complain about X.org ? XP ,Vista , Windows

Re: [rust-dev] Incremental and generational GC

2013-07-12 Thread Bennie Kloosteman
No cardtable ? Most generational GCs use a write barrier to mark pages accessed that way only objects in accessed pages need to be checked for higher to lower generation references http://blogs.msdn.com/b/abhinaba/archive/2009/03/02/back-to-basics-generational-garbage-collection.aspx Java doe

Re: [rust-dev] bikeshedding println() and friends

2013-07-13 Thread Bennie Kloosteman
The C printf way is very primative .. no new languages have used it in ages and even C++ tried to replace it with cout and overloading . I prefer the Java /C# way which is best from a coding simplicity and safety point of view but can handle different cases. stream.Write ( str1 + str2 +st

Re: [rust-dev] bikeshedding println() and friends

2013-07-15 Thread Bennie Kloosteman
anyway. On Mon, Jul 15, 2013 at 1:09 AM, Daniel Micay wrote: > On Sun, Jul 14, 2013 at 2:29 AM, Bennie Kloosteman > wrote: > > The C printf way is very primative .. no new languages have used it > in > > ages and even C++ tried to replace it with cout and overloading

[rust-dev] traits

2013-07-18 Thread Bennie Kloosteman
Can somebody either explain the following questions about Rust, or point me to a description, or (ideally) both? 1. I'm compiling the source code for some crate, and I need a trait implementation. Over what scope is the instance resolution search performed? [Following assume that the answer is "o

Re: [rust-dev] Incremental and generational GC

2013-07-25 Thread Bennie Kloosteman
Even 4K is probably too large most card tables are 128 or 256 bytes . Im pretty sure memory protection has been tried but i cant recall the paper. I do know Azul pauseless/concurrent collector uses the MMU but this is more for cocurrent mark/sweep reasons. They had an issue because which pages to

Re: [rust-dev] about unicode problem

2013-10-05 Thread Bennie Kloosteman
Windows only has 1 shell and it works with other products eg C# and Java so i think this is a bug .. The command shell ( and windows itself) supports Unicode but it must be usc2 not utf8 , the stack overflow response is not correct as it asumes Unicode = utf8. So if you convert to utf16 ( or eve