Re: [OT] Swift removing minor features to piss me off

2016-04-29 Thread bearophile via Digitalmars-d
e, on the other hand Rust is a bit more free than Swift now). Bear hugs, bearophile

Re: final switch and straight integers

2016-04-19 Thread bearophile via Digitalmars-d
s. It just needs to be implemented correctly. Bye, bearophile

Re: D vs Rust

2016-03-14 Thread bearophile via Digitalmars-d
age has being deleted... :-) https://www.reddit.com/r/programming/comments/49y7sc/11_myths_about_ada/ Bye, bearophile

Re: D vs Rust

2016-02-01 Thread bearophile via Digitalmars-d
xenon325: Doesn't http://wiki.dlang.org/DIP25 fix this ? I think DIP25 is designed to be only a partial solution, it's not a complete memory safety story. Bye, bearophile

Re: D vs Rust

2016-01-31 Thread bearophile via Digitalmars-d
e without having any experience of template metaprogramming, CTFE, and the like, and gradually absorb language features as you go. Phobos is pretty readable, on the whole. I agree with bearophile about GC making it easier in the beginning. bearophile: "I am sometimes able to write working D c

Re: D vs Rust

2016-01-30 Thread bearophile via Digitalmars-d
are sufficiently different, there's minimal overlapping in their purposes and niches. Bye, bearophile

Re: D vs Rust

2016-01-29 Thread bearophile via Digitalmars-d
and so on). I don't know if such safety features will be added to Rust, I am dubious. In the C/Ada world you have language subsets like MISRA/SPARK that people use in high integrity system. I think Rust still lacks something like that. Bye, bearophile

Re: Under 1000 opened bugs for Phobos

2015-12-02 Thread bearophile via Digitalmars-d
BBaz: So I don't know...and I ask, should the garbages from bearophile be closed ? Hello, I use D every day, and there are several functions that I'd like in Phobos. I think all/most of them can be of general usefulness. While I am often wrong, those ERs come from plenty of

Re: a "success story for D" ! !!

2015-05-05 Thread bearophile via Digitalmars-d
ponce: Paper: http://vlang.org/dvcon2014.pdf I'd say that's pretty huge! Very nice. Bye, bearophile

Re: if(arr) now a warning

2015-04-30 Thread bearophile via Digitalmars-d
:-) Bye, bearophile

Re: [hackathon] An article about metaprogramming

2015-04-29 Thread bearophile via Digitalmars-d
mixin(caseOnEvent!("SDL_SYSWMEVENT", "syswm")); default: //has to be there even if empty static if(is(typeof(that.onOther(Event.init { that.onOther(polledEvent); break; } } The default should be aligned just like the other cases. Often is a good idea to use "final switch" with enumerations. Probably there are ways to make that code more dry, using a TypeTuple of pairs like ("SDL_QUIT", "quit"). Bye, bearophile

Re: if(arr) now a warning

2015-04-29 Thread bearophile via Digitalmars-d
d like this. My presence around here is becoming useless. Bye, bearophile

Re: C++ const expression are not that const after all

2015-04-28 Thread bearophile via Digitalmars-d
interactions and make complexity more manageable. His finding seems a design mistake. Bye, bearophile

Re: switch case expressions

2015-04-23 Thread bearophile via Digitalmars-d
Martin Krejcirik: So, should the case b compile or not ? Is the spec too restrictive here, or is it a bug ? Apparently it's a WONTFIX mess. The spec should be updated. Walter&Andrei refused to fix a design bug here. Bye, bearophile

Re: Cleaned up C++

2015-04-23 Thread bearophile via Digitalmars-d
Walter Bright: On 4/22/2015 2:58 PM, bearophile wrote: D is less stack-friendly than Ada (and probably Rust too), ?? In Ada standard library you have safe fixed-size stack-allocated associative arrays. In D you can't even allocate safely a dynamically-sized 1D array on the stack

Re: Cleaned up C++

2015-04-22 Thread bearophile via Digitalmars-d
don't put everything on the heap. D is less stack-friendly than Ada (and probably Rust too), but in D you allocate lot of small stuff on the stack. Bye, bearophile

Re: Vectorization examples

2015-04-20 Thread bearophile via Digitalmars-d
f the video, where he shows an annotation to compile functions for different CPUs, where the compiler updates function pointers inside the binary according to the CPU you are using, making the code safe and efficient. Bye, bearophile

Vectorization examples

2015-04-20 Thread bearophile via Digitalmars-d
better than the aligned() shown here, because I prefer the alignment to be part of the type), and a way to tell the type system that some array slices are fully distinct (the __restrict seen here, I think this information doesn't need to be part of a type). Bye, bearophile

Re: D vs nim

2015-04-20 Thread bearophile via Digitalmars-d
Russel Winder: it is all part of guerilla marketing undertaken by anyone with anything to market. It's still not a correct behavour, regardless how many do it. Bye, bearophile

Re: How about appender.put() with var args?

2015-04-16 Thread bearophile via Digitalmars-d
Márcio Martins: app.put("foo"); app.put(var); app.put("bar"); I'd like put() to accept a lazy range... Bye, bearophile

Re: Does 'D' language supports 'C' like VLA?

2015-04-14 Thread bearophile via Digitalmars-d
explicit. You don't forget to put branches added by the compiler, so it's safer. Generally you prefer something that's guaranteed to be allocated on the stack when it's small and there's enough stack. An array allocation annotated with "scope", perhaps. Bye, bearophile

Re: Programming languages and performance

2015-04-14 Thread bearophile via Digitalmars-d
weaselcat: It's reddit, that's not really surprising. Do you know a place better than Reddit for general programming discussions? The lambda the ultimate blog is not generic. Bye, bearophile

Re: Programming languages and performance

2015-04-14 Thread bearophile via Digitalmars-d
Bye, bearophile

Re: Does 'D' language supports 'C' like VLA?

2015-04-13 Thread bearophile via Digitalmars-d
nough. They are uncommonly used because they are not supported by the D compiler, and it doesn't track the memory ownership well enough. But a well designed system language needs to push programmers to use the stack as much as possible. Bye, bearophile

Re: DIP77 - Fix unsafe RC pass by 'ref'

2015-04-12 Thread bearophile via Digitalmars-d
hink D Zen asks for safety on default and opt-out on request. See also "@safe by default": https://issues.dlang.org/show_bug.cgi?id=13838 Bye, bearophile

Re: if(arr) now a warning

2015-04-09 Thread bearophile via Digitalmars-d
Steven Schveighoffer: What do you think? I asked for this fix almost five years ago, so I think it's about time :-) Bye, bearophile

Re: Why I'm Excited about D

2015-04-08 Thread bearophile via Digitalmars-d
deadalnix: foreach (name; names.parallel) { name.writeln; } no.please I think "foo.writeln;" is acceptable. You just need to get a bit used to it. Bye, bearophile

Re: Fun project - faster associative array algorithm

2015-04-07 Thread bearophile via Digitalmars-d
linear and not intuitive. As Walter has said at the the start of this thread, arrays come out as more efficient in a large number of cases... Bye, bearophile

Re: Fun project - faster associative array algorithm

2015-04-07 Thread bearophile via Digitalmars-d
w0rp: It doesn't amaze me at the moment, as it's slightly faster for integers, and slightly slower for strings at the moment. One problem with D strings is that they don't cache their hash value. Bye, bearophile

Re: DIP76: Autodecode Should Not Throw

2015-04-07 Thread bearophile via Digitalmars-d
Vladimir Panteleev: std.conv doesn't return NaN if you try to convert "banana" to a double. I have suggested to add a nothrow function like "maybeTo" that returns a Nullable result. Bye, bearophile

Re: Questions about phobos additions mentioned in 2015H1 vision document

2015-04-05 Thread bearophile via Digitalmars-d
have a lighter std lib). Bye, bearophile

Re: The next iteration of scope

2015-04-04 Thread bearophile via Digitalmars-d
Walter Bright: I'm not convinced of the need for overloading on 'scope'. Do you want to explain some of the advantages and disadvantages of that? It will help understand your reasons. Bye, bearophile

Re: Benchmark of D against other languages

2015-04-02 Thread bearophile via Digitalmars-d
, bearophile

Re: Benchmark of D against other languages

2015-04-02 Thread bearophile via Digitalmars-d
in a very bug-prone way. Sometimes C++ is a bad example to follow (like with permutations generations, that currently is not a Range in Phobos for the wrong reasons). Bye, bearophile

Re: Benchmark of D against other languages

2015-04-01 Thread bearophile via Digitalmars-d
perform some safe integer operations. So is the API very well compatible with those intrinsics? Bye, bearophile

Re: The next iteration of scope

2015-04-01 Thread bearophile via Digitalmars-d
that takes us. This is interesting. For the final D programmer what's the practical difference between your proposed subset compared to the full proposal? Bye, bearophile

Re: Benchmark of D against other languages

2015-04-01 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Oh boy all classes with one-liner non-final methods. Manu must be dancing a gig right now :o). -- Andrei Yes, the right default for D language should be final, because lot of programmers are lazy and they don't add attributes. Bye, bearophile

Re: Adding sets to the language.

2015-03-29 Thread bearophile via Digitalmars-d
w0rp: Every now and then I want a set type, I think you can implement good enough sets in Phobos, do you agree? But you can't do the same with tuples. So I prefer sets in Phobos and tuples in the language. Bye, bearophile

Re: Why dont dlang check NullPointer?

2015-03-27 Thread bearophile via Digitalmars-d
zhmt: In short words, I want to catch something like NullPointerException. Is this possible? One solution is to add null tests to D in nonrelease mode. A better solution is to modify D to remove all or most chances of dereferencing null pointers and class references. Bye, bearophile

Re: [Phobos] You're crippled by your orthodoxism

2015-03-26 Thread bearophile via Digitalmars-d
Jean pierre: This is a problem, you, the D core has: you're crippled by your orthodoxism. Nothing will be added because of this: **rules**. The current level of acceptance of Phobos patches seems roughly correct to me. Bye, bearophile

Re: uniform tuple syntax

2015-03-25 Thread bearophile via Digitalmars-d
Vlad Levenfeld: Anything going on with this? Been looking forward to seeing it for awhile. It will happen. Bye, bearophile

Re: dfmt options

2015-03-23 Thread bearophile via Digitalmars-d
Jacob Carlborg: Although I would like that the D syntax allowed to drop the curly braces, like with if-satements. That would result in much nicer one-liner functions. See: https://issues.dlang.org/show_bug.cgi?id=7176 Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-19 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: You may want to answer there, not here. I've also posted a response. There is this, with an attach: https://issues.dlang.org/show_bug.cgi?id=11810 Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-18 Thread bearophile via Digitalmars-d
bad code if you don't keep your eyes and brain switched on. Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-18 Thread bearophile via Digitalmars-d
ion) is going in the opposite direction, and for good reasons. An explanation: https://channel9.msdn.com/Events/GoingNative/2013/Cpp-Seasoning Bye, bearophile

Re: Replace core language HexStrings with library entity

2015-03-17 Thread bearophile via Digitalmars-d
Baz: https://github.com/D-Programming-Language/phobos/pull/3058 I suggest to replace "litteral" with "literal", as in computer science: http://en.wikipedia.org/wiki/Literal_%28computer_programming%29 Bye, bearophile

Re: Replace core language HexStrings with library entity

2015-03-16 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: That opens the question whether we want only ubyte[] for hex bytes or all integral types. I suggest to implement only ubyte[] first. And wait for enhancement requests. Bye, bearophile

Re: The next iteration of scope

2015-03-16 Thread bearophile via Digitalmars-d
Marc Schütz: Here's the new version of my scope proposal: http://wiki.dlang.org/User:Schuetzm/scope2 Let's see what Andrei and Walter think about this all :-) Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-16 Thread bearophile via Digitalmars-d
that wants to be a little functional. Alternative ways to allocate memory are needed by some people. The GC needs improvements. Purity is not yet finished. And there are minor things that can be improved. D3 is not planned, so the only way is to improve D2. Bye, bearophile

Re: Replace core language HexStrings with library entity

2015-03-15 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: hexString and hexBytes. -- Andrei Can you show me one or two different use cases of hexString? Bye, bearophile

Re: Replace core language HexStrings with library entity

2015-03-15 Thread bearophile via Digitalmars-d
ssues.dlang.org/show_bug.cgi?id=5909 Bye, bearophile

Re: Replace core language HexStrings with library entity

2015-03-15 Thread bearophile via Digitalmars-d
Marc Schütz: Can we make it so it returns a ubyte[]? There is an enhancement request on this (for the built in hex strings). Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-15 Thread bearophile via Digitalmars-d
Walter Bright: I'd also prefer to get rid of /+ +/ comments, I thought they'd be more useful than they are. I prefer to get rid of /* */ instead :-) Because /++/ can do things /**/ can't. Bye, bearophile

Template constraints

2015-03-15 Thread bearophile via Digitalmars-d
ced to add user-defined error messages to template constraints, and is such enhancement a good idea? Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-14 Thread bearophile via Digitalmars-d
lot, then probably you also like to read a language with the help of a book. Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-14 Thread bearophile via Digitalmars-d
pared to Sage. Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-13 Thread bearophile via Digitalmars-d
Walter Bright: On 3/13/2015 3:34 AM, bearophile wrote: "Strict mode" is a D2 with immutable+@safe+pure by default, Thank you Walter for giving me an actual answer :-) Note that you can get this largely by starting a module with the following: immutable @safe pure: "i

Re: A few notes on choosing between Go and D for a quick project

2015-03-13 Thread bearophile via Digitalmars-d
u for your help. Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-13 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: That's a rather random collection - "strict" seems to be "D without the stuff bearophile dislikes". -- Andrei I am OK with that definition. Is that your best critique to those suggestions? :-) Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-13 Thread bearophile via Digitalmars-d
;d still like built-in tuple syntax in D. Bye, bearophile

Re: A few notes on choosing between Go and D for a quick project

2015-03-12 Thread bearophile via Digitalmars-d
age; D seems to embody too many ideas at once ## concurrency? ## networking? ## generics? ## interoperability with C and C++? ## focus on one! D can't be a single-purpose language. And it has more moving parts compared to Go. Bye, bearophile

Re: Parallel Merge Sort

2015-03-04 Thread bearophile via Digitalmars-d
some more reliable code then... Bye, bearophile

Re: Parallel Merge Sort

2015-03-04 Thread bearophile via Digitalmars-d
contain the pointer+length of the dynamic arrays. Bye, bearophile

Re: RCArray is unsafe

2015-03-04 Thread bearophile via Digitalmars-d
code to work around some of those limitations. And if the design is good, such islands of unsafety are located inside Phobos constructs that leak (http://en.wikipedia.org/wiki/Leaky_abstraction ) very little. Bye, bearophile

Re: RCArray is unsafe

2015-03-04 Thread bearophile via Digitalmars-d
Walter Bright: The complexity of a free list doesn't remotely compare to that of adding an ownership system. A sound complete ownership system is the only good enough solution for D. That's my opinion. Bye, bearophile

Re: Parallel Merge Sort

2015-03-03 Thread bearophile via Digitalmars-d
bottomUpMerge(A, i, min(i + width, n), min(i + 2 * width, n), B); } // Now work array B is full of runs of length 2*width. swap(A, B); } } void main() { auto a = [3,1,2,5,4,8,6,7,2,9,1,4,3]; a.mergeSort; a.writeln; } Bye, bearophile

Re: DIP74: Reference Counted Class Objects

2015-03-01 Thread bearophile via Digitalmars-d
DIP74. Bye, bearophile

Re: Contradictory justification for status quo

2015-03-01 Thread bearophile via Digitalmars-d
t was that probably there are even better things that Kenji can do in part of the time he works on D. Bye, bearophile

Re: Contradictory justification for status quo

2015-02-28 Thread bearophile via Digitalmars-d
to reduce the annotation burden in many cases. Bye, bearophile

Re: Contradictory justification for status quo

2015-02-28 Thread bearophile via Digitalmars-d
of D. Bye, bearophile

Re: What am I doing wrong here - canFind with iota is not working

2015-02-27 Thread bearophile via Digitalmars-d
immutable float item = 0.174531f; r.canFind!q{ feqrel(cast()a, cast()b) >= 21 }(item).writeln; } With a recent Phobos bug fix you can now write: r.canFind!q{ feqrel(a, b) >= 21 }(item).writeln; Bye, bearophile

Re: Contradictory justification for status quo

2015-02-27 Thread bearophile via Digitalmars-d
://issues.dlang.org/show_bug.cgi?id=13838 Bye, bearophile

Re: DIP74: Reference Counted Class Objects

2015-02-26 Thread bearophile via Digitalmars-d
ers.< Is this currently enforced in all D compilers? This DIP allows defining reference counted class objects that are usable in @safe code. However, it does not enforce safety.< And do you plan to later design what's needed to enforce their safety? Bye, bearophile

Re: What am I doing wrong here - canFind with iota is not working

2015-02-26 Thread bearophile via Digitalmars-d
); immutable float second = (oneDegree * 10.0f); immutable float step = 0.01f; immutable float[] r = iota(first, second, step).array; //r.writeln; immutable float item = 0.174531f; r.canFind!q{ feqrel(cast()a, cast()b) >= 21 }(item).writeln; } Bye, bearophile

Re: Memory safety depends entirely on GC ?

2015-02-24 Thread bearophile via Digitalmars-d
. I'd like DIP25 removed from D language and replaced by a more principled solution. Sometimes a heavier solution can be simpler to understand (and it can be actually safe). Bye, bearophile

Re: Memory safety depends entirely on GC ?

2015-02-24 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: using stack-allocated arrays in safe code is a rather niche use). I use stack-allocated arrays in supposedly safe code. And having a future D compiler that makes that kind of code actually safe is a good thing. Bye, bearophile

Re: A Refcounted Array Type

2015-02-23 Thread bearophile via Digitalmars-d
worth the effort). Bye, bearophile

Re: Let's Play Code Golf

2015-02-23 Thread bearophile via Digitalmars-d
ach(n;stdin.byLine.drop(1))writefln("%.15f",iota(n.to!int).map!"(-1.0)^^a/(2*a+1)".sum);} You can remove one char: iota(n.to!int). n.to!int.iota. Bye, bearophile

Re: DDMD just went green on all platforms for the first time

2015-02-22 Thread bearophile via Digitalmars-d
thout unittests, and few more basic data points. Bye, bearophile

Re: contiguous ranges

2015-02-17 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: for an array r, is r.retro contiguous or not? Is the most useful contiguous range forward? So can you name it ForwardContiguousRange? Bye, bearophile

Re: Consistency

2015-02-16 Thread bearophile via Digitalmars-d
isions, I hope they have removed this problem). Bye, bearophile

Re: contiguous ranges

2015-02-16 Thread bearophile via Digitalmars-d
, instead perform an optimized batch transfer directly to a ContiguousRange via ptr. Increasing the number of basic ranges will lead to a little more complexity, but this seems a nice idea. Bye, bearophile

Re: Consistency

2015-02-16 Thread bearophile via Digitalmars-d
Daniel Murphy: No, they were still O(n) worst case, for a single bucket with a degenerate binary tree. I see. I was unable to hit this degenerate case in my testing code, but I guess that was possible. Thank you. Bye, bearophile

Re: Consistency

2015-02-15 Thread bearophile via Digitalmars-d
;s not too much hard to find and hit that O(n) case. Bye, bearophile

Re: Consistency

2015-02-15 Thread bearophile via Digitalmars-d
Xinok: In that respect, it only makes sense for dictionaries Values as in Python are much more useful for arrays :-) Meta: D is better off than Python in this case, I've never subscribed with point of view :-) Bye, bearophile

Re: Consistency

2015-02-15 Thread bearophile via Digitalmars-d
John Colvin: tup1.expand.only.countUntil(2).writeln; Admittedly, it's a little longer than expected :) A little shorter: tup1[].only.countUntil(2).writeln; Bye, bearophile

Re: A safer interface for core.stdc

2015-02-08 Thread bearophile via Digitalmars-d
H. S. Teoh: Come to think of it, is there any point in making malloc @safe/@trusted at all? I am not asking for a @trusted function. I'd like a @system template wrapper for malloc/calloc/free that is safer than the C functions (safer because it's type-aware). Bye, bearophile

Re: A safer interface for core.stdc

2015-02-07 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Such wrappers would allow safe code to use more C stdlib primitives. I'd also like a safer templated wrapper for calloc() and malloc() and similar. Bye, bearophile

Re: Another idiom I wish were gone from phobos/druntime

2015-02-06 Thread bearophile via Digitalmars-d
bit too much for the average human to handle :-) Sometimes features help, but that list seems excessive for a language that is not meant for high integrity systems as D. Bye, bearophile

Some notes on Rust

2015-02-05 Thread bearophile via Digitalmars-d
In the best language blog: http://lambda-the-ultimate.org/node/5113 The discussion is long. They discuss if a good GC can be written in the language itself, about actual security, what a GC can and can't do, and more. Bye, bearophile

Re: Another idiom I wish were gone from phobos/druntime

2015-02-04 Thread bearophile via Digitalmars-d
s if* in an 'in' contract. That solves the tooling problem and the too-much-code problem, no? Bad idea. We had DbC, let's start using it. Bye, bearophile

Re: Another idiom I wish were gone from phobos/druntime

2015-02-04 Thread bearophile via Digitalmars-d
be in transforming a 5-liner into a 9-liner? Contracts can be read by tools, and they are part of the function signature. Contracts should be encouraged and increased, not discouraged. Bye, bearophile

Re: FYI - DIP25 is approved for 2.067

2015-02-04 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: http://wiki.dlang.org/DIP25 I'd like a more comprehensive and flexible solution to the problem of static memory ownership. Bye, bearophile

Re: Arrays, garbage collection

2015-01-30 Thread bearophile via Digitalmars-d
think lot of people is going to write code like that. And if you are about to suggest this: alias S = staticArray; Well, do you like to see aliases in your code? Bye, bearophile

Re: Arrays, garbage collection

2015-01-30 Thread bearophile via Digitalmars-d
s the code bad. Thanks. Bye, bearophile

Re: Arrays, garbage collection

2015-01-30 Thread bearophile via Digitalmars-d
Daniel Kozák: No, it makes more bugs possible // this is compile error so its ok int[MUST_HAVE_FIVE_ITEMS] a=[1,2,3,5]; // Error: mismatched array lengths, 5 and 4 Have you tried to compile my code? It doesn't give an error. Bye, bearophile

Arrays, garbage collection

2015-01-29 Thread bearophile via Digitalmars-d
ecome safer and reduce the work for the GC. I think only a limited percentage of arrays need to be fully handled by the GC. Bye, bearophile

From C#7 and Haskell

2015-01-29 Thread bearophile via Digitalmars-d
pport. Native relational algebra data type. - An awful lot of data mining and analysis is best done with relational algebra. - Not just in the database. Bye, bearophile

Re: accept @pure @nothrow @return attributes

2015-01-28 Thread bearophile via Digitalmars-d
f you want/need to use numpy, the fourth is good. No problems :-) Bye, bearophile

Re: accept @pure @nothrow @return attributes

2015-01-28 Thread bearophile via Digitalmars-d
ortant, because usually there are multiple ways to do something, but only one of them should be obvious in Python :-) Bye, bearophile

  1   2   3   4   5   6   7   8   9   10   >