Re: What are the worst parts of D?

2014-09-26 Thread bearophile via Digitalmars-d
Sean Kelly: When I use algorithms on strings in D, I always cast them to ubyte[]. Which is a poor solution. In Phobos we have representation, and assumeUTF that are better than naked casts. I use them only sparingly (and I avoid cast), despite I use strings often. Bye, bearophile

Re: Deprecations: Any reason left for warning stage?

2014-09-26 Thread bearophile via Digitalmars-d
Daniel Kozák: The only one and right solution is print warning message by default I am asking for this since some years. Bye, bearophile

Re: Deprecations: Any reason left for warning stage?

2014-09-26 Thread bearophile via Digitalmars-d
H. S. Teoh: In git HEAD, dmd now allows use of deprecated features and displays a warning by default. I meant I'd like by default all warnings to be shown :-) Bye, bearophile

Re: Can I make a variable public and readonly (outside where was declared) at same time?

2014-09-26 Thread bearophile via Digitalmars-d-learn
; } } You can call them a and a_. Why are you not recommending this solution? It looks cool (if it works). Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-25 Thread bearophile via Digitalmars-d
to allocate it from a single allocator. I don't think this feature will work. I think he's already using this strategy in production code. So I think it works. He's just asking for a language feature that implements this idiom for him in a shorter and cleaner way. Bye, bearophile

Re: Escaping the Tyranny of the GC: std.rcstring, first blood

2014-09-25 Thread bearophile via Digitalmars-d
by Maxime Chevalier-Boisvert). Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-25 Thread bearophile via Digitalmars-d
Walter Bright: So how do you tell it to call myfree(p) instead of free(p) ? I think you can't in the form he has shown. He's far from being a good language designer, after all :-) Bye, bearophile

Re: What are the worst parts of D?

2014-09-25 Thread bearophile via Digitalmars-d
the names of lstrip and rsplit of Python string functions. Bye, bearophile

enumerate, and some improvements

2014-09-24 Thread bearophile via Digitalmars-d
: 10, 2: 20]; auto r3 = map!(k = aa[k])(keys); // OK auto r4 = map!aa(keys); // Error } This is a common idiom in Clojure. Arrays and associative arrays can be seen as functions defined by an enumeration of input-outputs. Bye, bearophile

Re: What are the worst parts of D?

2014-09-24 Thread bearophile via Digitalmars-d
some time, do the other language updates that you think are good. Bye, bearophile

Re: Analysis of programming languages on Rosetta

2014-09-24 Thread bearophile via Digitalmars-d
written also performance conscious D entries (sometimes I have added various D solutions, at various levels of performance, succinctness, safety correctness). Bye, bearophile

Re: Analysis of programming languages on Rosetta

2014-09-24 Thread bearophile via Digitalmars-d
://news.ycombinator.com/item?id=8363666 Bye, bearophile

Re: Analysis of programming languages on Rosetta

2014-09-24 Thread bearophile via Digitalmars-d
that site is, It's sufficiently known, but perhaps only for certain programmers. The ones that care about the design of programming languages are more likely to know it. Bye, bearophile

Re: Analysis of programming languages on Rosetta

2014-09-24 Thread bearophile via Digitalmars-d
of the contributors and amount of time spent, it's also first of all a matter of how much semantically clean you want to write the code, how many abstractions you accept to remove from the implementation, how much you care for many factors more than performance, etc. Bye, bearophile

Re: RFC: scope and borrowing

2014-09-23 Thread bearophile via Digitalmars-d
a; } Bye, bearophile

Re: RFC: scope and borrowing

2014-09-23 Thread bearophile via Digitalmars-d
ends you have a x1 reference to the array data. Such reference x1 is unique, so now 'a' is not usable any more, you can't pass 'a' to foo once more. I need to learn more about such stuff of linear typing. Bye, bearophile

Re: RFC: scope and borrowing

2014-09-23 Thread bearophile via Digitalmars-d
is a quality regardless of optimizations, because it makes both unit testing and code understanding simpler :-) I am not very expert on this stuff, I need to learn more. Bye, bearophile

Re: Library Typedefs are fundamentally broken (alternate implementation)

2014-09-23 Thread bearophile via Digitalmars-d
Andrej Mitrovic: alias Same_Type_1 = Typedef!(void*, null, cookie); alias Same_Type_2 = Typedef!(void*, null, cookie); static assert(is(Same_Type_1 == Same_Type_2)); // unsafe *only if you request it* I suggest to not offer this usage possibility. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-23 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: It's the poetic injustice of Typedef is broken/unusable I have a problem with. -- Andrei You seem the only one with such problem :-) Bye, bearophile

Re: What are the worst parts of D?

2014-09-23 Thread bearophile via Digitalmars-d
to finish shared libs, to test the patch from Kenji that fixes the module system, and more. Bye, bearophile

Re: Local imports hide local symbols

2014-09-23 Thread bearophile via Digitalmars-d
; } But this design can't be used now in D. So I suggest to add anti hijacking logic similar to the with() command. When such name hiding errors are generated by a local import, the programmer has to list imported names, or use renamed imports. Bye, bearophile

Re: RFC: reference counted Throwable

2014-09-22 Thread bearophile via Digitalmars-d
and ref? This seems a bad idea, because GC and scope tracking is a sufficiently large design implementation space. You can't face all the large problems at the same time. Bye, bearophile

Re: RFC: reference counted Throwable

2014-09-22 Thread bearophile via Digitalmars-d
Nick Treleaven: - It is slow to compile. Surely that's not an inherent property of Rust? We don't know yet. Perhaps Rust type inference needs lot of computations. Bye, bearophile

Re: RFC: reference counted Throwable

2014-09-22 Thread bearophile via Digitalmars-d
of C#5. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-22 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: I find the requirement for the cookie perfect. So far you're the only one, it seems. And you have admitted you have not tried to use them significantly in your code. Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-21 Thread bearophile via Digitalmars-d
that can wreak a program. Ada (and in a less intense way D) try to help the programmer write correct code for some of them too (and other languages are ATS, Whiley, F*, Idris, etc, cover other forms of correctness). Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-21 Thread bearophile via Digitalmars-d
Paulo Pinto: (and other languages are ATS, Whiley, F*, Idris, etc, cover other forms of correctness). ... You can handle units of measure via tuples structs, since you mention F#. Here I mentioned F*, not F#: http://research.microsoft.com/en-us/projects/fstar/ Bye, bearophile

Strings iteration and immutable

2014-09-21 Thread bearophile via Digitalmars-d
) The string a is composed of immutable(char) after all. For me it's strange that iterating on arrays of immutable chars or immutable dchars gives an output of different constness. This looks like a gratuitous breakage of symmetry :-) Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread bearophile via Digitalmars-d
safety is not important If type safety is not so important in a piece of code, you probably are already not using a typedef/Typedef/newtype. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread bearophile via Digitalmars-d
, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread bearophile via Digitalmars-d
or later a dirty semantics will bite your ass. Mine ain't hurting. -- Andrei This is not surprising because you say you have not used Typedef much in your code. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-21 Thread bearophile via Digitalmars-d
against someone else more deserving? Bye, bearophile

Re: DMD v2.066.1-rc2

2014-09-20 Thread bearophile via Digitalmars-d-announce
. Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-20 Thread bearophile via Digitalmars-d
), to code in a more handy way. Perhaps this new situation (no implicit conversions, plus two kinds of casts, and few extra literals) is safer than the current D situation (and I think no C code gains a new working meaning in this new situation). Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-20 Thread bearophile via Digitalmars-d
auto-vectorization). Bye, bearophile

Re: RFC: reference counted Throwable

2014-09-20 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Are you suggesting we implement ARC? Yes. -- Andrei I think it's better first to design implement a first version of memory ownership management, and then later add a reference counting scheme. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-20 Thread bearophile via Digitalmars-d
/issues/show_bug.cgi?id=11828 Some other open issues/ERs: https://issues.dlang.org/buglist.cgi?f1=short_desco1=casesubstringquery_format=advancedresolution=---v1=Typedef Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-20 Thread bearophile via Digitalmars-d
ketmar: but i know: octal literals are handy, so they will never make their way to mainline. typedef construct is handy, so... A well working Typedef/typedef (named newtype in Haskell, where it's a built-in) is more commonly useful than octal literals. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-20 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: But it can be used. Have you used it in your real D code three or more times? I have tried and I have found many problems. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-20 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Have you used it in your real D code three or more times? No, but that doesn't mean much. It means that I have more experience than you in using Typedef, and in my experience their usage is not so good. Bye, bearophile

Re: RFC: reference counted Throwable

2014-09-20 Thread bearophile via Digitalmars-d
against Rust? Bye, bearophile

Re: Are void arrays usable ?

2014-09-20 Thread bearophile via Digitalmars-d-learn
a look in bugzilla, if it's not already present file it. Bye, bearophile

Re: Are void arrays usable ?

2014-09-20 Thread bearophile via Digitalmars-d-learn
Take a look in bugzilla, if it's not already present file it. https://issues.dlang.org/show_bug.cgi?id=13505 Bye, bearophile

Re: enum-indexed arrays

2014-09-20 Thread bearophile via Digitalmars-d-learn
] is an associative array with I index and int values. So in another post I have suggested another syntax. Bye, bearophile

Re: enum-indexed arrays

2014-09-20 Thread bearophile via Digitalmars-d-learn
Nordlöw: should be Enumerator start = Enumerator.min This also requires the enum to have adjacent values (in general enums can skip values). Bye, bearophile

Re: [Semi OT] Language for Game Development talk

2014-09-19 Thread bearophile via Digitalmars-d
): -- void do_something(Entity ?a) { if (a) { a.x = 0; } } -- Bye, bearophile

Re: Multiple alias this is coming.

2014-09-18 Thread bearophile via Digitalmars-d-announce
IgorStepanov: I've created pull request, which introduces multiple alias this. Can someone show one or more usage cases? Thank you, bye, bearophile

Re: Multiple alias this is coming.

2014-09-18 Thread bearophile via Digitalmars-d-announce
IgorStepanov: Do you ask about alias this or about it multiple usage. Multiple usage is similar to single, but multiple:) I meant the multiple usage. And none of your examples here are use cases :-( I'd like to see one use case, or more. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-18 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Wyatt: (I wouldn't consider the cookie parameter a better solution; I would consider it a wart.) That's the right solution. The cookie parameter is a ugly wart. Bye, bearophile

Re: String[] pointer to void* and back

2014-09-18 Thread bearophile via Digitalmars-d-learn
anonymous: Here, the pointer to the stack escapes the function. Don't do that! Hopefully the D type system will be improved with scoping tracking management, to turn similar operations into compilation errors (as in Rust, but perhaps in a less refined way). Bye, bearophile

Re: Increasing D's visibility

2014-09-17 Thread bearophile via Digitalmars-d
, and one that shows longer hairier fast code. In some cases I'd even like to show a third safe version (that tries to be more correct), but most Shootout/ComputerGame benchmarks are not very fit for this (you can see some examples of this on Rosettacode). Bye, bearophile

Re: Increasing D's visibility

2014-09-17 Thread bearophile via Digitalmars-d
the various programs will need updates. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-17 Thread bearophile via Digitalmars-d
have to copy it's often better to copy from Lisp/ML/Ada instead of C++). Bye, bearophile

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread bearophile via Digitalmars-d-learn
H. S. Teoh: How do you implement a completely GC-free AA with no limit on number of entries stored? Ada2012 has a fixed-size hash in the standard library, it can even be allocated on the stack. But the number of entries is not unlimited. Bye, bearophile

Flexible and efficient recursive hashing

2014-09-16 Thread bearophile via Digitalmars-d
in a flexible and efficient way. Perhaps the idea can be used in D too. It suggests the introduction of a hashAppend standard method. Bye, bearophile

Re: Library Typedefs are fundamentally broken

2014-09-16 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: Add a sequence number as a uint, defaulted to 0. -- Andrei See discussion: https://d.puremagic.com/issues/show_bug.cgi?id=12100 Bye, bearophile

Re: switch statement exiting a void function

2014-09-16 Thread bearophile via Digitalmars-d-learn
; case opt2: fun2(...); break; case opt3: fun3(...); break; } Bye, bearophile

Re: Escaping the Tyranny of the GC: std.rcstring, first blood

2014-09-15 Thread bearophile via Digitalmars-d
, bearophile

Re: Escaping the Tyranny of the GC: std.rcstring, first blood

2014-09-15 Thread bearophile via Digitalmars-d
for function/ctor arguments), or features that have a limited scope and don't increase the general code complexity much (like the partial type inference patch created by Kenji). Bye, bearophile

Re: Function Pointers with Type T

2014-09-15 Thread bearophile via Digitalmars-d
function(T val1,T val2) ptr = comp; spiltPoint = partition(list, ptr, left, right); } void main() {} Bye, bearophile

Re: Stroustrup's slides about c++11 and c++14

2014-09-15 Thread bearophile via Digitalmars-d
is not going to help any one. Bye, bearophile

Re: Increasing D's visibility

2014-09-15 Thread bearophile via Digitalmars-d
reasons. Bye, bearophile

Early detection of type errors in templates

2014-09-14 Thread bearophile via Digitalmars-d
Erwig: http://web.engr.oregonstate.edu/~erwig/papers/C++TemplateErrors_PEPM14.pdf Bye, bearophile

Integral literals with Exp?

2014-09-13 Thread bearophile via Digitalmars-d
Is it a good idea to accept code like this, to shorten some constants? void main() { int x = 1e6; } Bye, bearophile

Re: C++ interop - what to do about long and unsigned long?

2014-09-13 Thread bearophile via Digitalmars-d
Manu: Surely, at very least, an extern(C++) class should be final-by-default? Often the less special cases you have, the less bugs you create. So I suggest final to be handled in the same way in both regular and extern(C++) classes. Bye, bearophile

Regarding Nullables

2014-09-13 Thread bearophile via Digitalmars-d
!int. ... I think it's better for write(Nullable!int()) to not raise an error, but to print something like a null etc. A bigger problem is in the usage of Nullable. I'd like the D type system to be modified and improved to support Nullables with a nicer syntax. Bye, bearophile

Re: Stroustrup's slides about c++11 and c++14

2014-09-13 Thread bearophile via Digitalmars-d
Andrei Alexandrescu: D offers strong evidence that static if is an enormously useful construct. But it's not a complete typing. The Concepts Lite are a more principled and safer solution. (Are Rust templates comparable to first order Concepts Lite?) Bye, bearophile

Re: Common scope for function's in{}, out(result){} and body{}

2014-09-12 Thread bearophile via Digitalmars-d
Ilya Yaroshenko: immutable length = r1.length; //Error, can't use function parameters. Time ago it was argued that if the use of function parameters is allowed there (to define constants), you have poor's man pre-state (old) in D. Bye, bearophile

Re: Common scope for function's in{}, out(result){} and body{}

2014-09-12 Thread bearophile via Digitalmars-d
, bearophile

Re: It turns out it's quite hard to have @safe pure nothrow functions. Oh, and const.

2014-09-12 Thread bearophile via Digitalmars-d
) is a work in progress, and there are also some blocking problems (Like: http://forum.dlang.org/thread/stlslhjndgugecvmb...@forum.dlang.org ). In some cases some functions can't just have all attributes, because they need to throw, or they are not designed to be pure, etc. Bye, bearophile

Re: RFC: scope and borrowing

2014-09-11 Thread bearophile via Digitalmars-d
it? At the moment the focus seems to be: 1) C++ interoperability 2) GC (in theory). Bye, bearophile

Re: std.algorithm.reduce on an array of structs

2014-09-11 Thread bearophile via Digitalmars-d-learn
)]; ar2.minimum.writeln; } Bye, bearophile

Re: C++ interop - what to do about long and unsigned long?

2014-09-10 Thread bearophile via Digitalmars-d
of memory areas in D. So I am seeing a priority problem here). Bye, bearophile

Re: Damncheck - a property-based testing library

2014-09-09 Thread bearophile via Digitalmars-d-announce
a QuickCheck-like library needs to become standard tool used to test most D projects. There are many other related ideas, like: http://www.cse.chalmers.se/~nicsma/quickspec.pdf Bye, bearophile

Re: zero-ing is not enough

2014-09-09 Thread bearophile via Digitalmars-d
John Colvin: http://www.daemonology.net/blog/2014-09-06-zeroing-buffers-is-insufficient.html D could incorporate something like this, no? See: https://d.puremagic.com/issues/show_bug.cgi?id=10661 Walter seems OK with adding something like that to the D intrinsics. Bye, bearophile

Re: @nogc, exceptions, generic containers... Issues.

2014-09-09 Thread bearophile via Digitalmars-d
Meta: let ratio = try!(div(x, y)); becomes let ratio = match div(x, y) { Ok(val) = val, Err(msg) = { return Err; } } Maybe we need a similar solution for @nogc. Related: https://d.puremagic.com/issues/show_bug.cgi?id=6840 Bye, bearophile

Re: Encapsulating trust

2014-09-02 Thread bearophile via Digitalmars-d
ketmar: and that is why my local D diverges more and more from mainline D. This is a bad idea, it leads to an increase of your dissatisfaction, until you stop using D :-( Bye, bearophile

Re: Encapsulating trust

2014-09-02 Thread bearophile via Digitalmars-d
Paulo Pinto: For some strange reason human life critical systems are written in Ada, SPARK, MISRA C dialect If D designers and developers work to make D better for those usages, someday D could be used to replace the MISRA C and perhaps even some less strict usages of Ada. Bye, bearophile

Re: Possible difference in compilers?

2014-09-01 Thread bearophile via Digitalmars-d-learn
the import inside the main, to add a space after the commas, and to add an immutable to foreach variable. Bye, bearophile

Re: A significant performance difference

2014-09-01 Thread bearophile via Digitalmars-d-learn
fit for a performance bug report. I have to create a synthetic benchmark that shows just the problem. Bye, bearophile

Re: A significant performance difference

2014-09-01 Thread bearophile via Digitalmars-d-learn
It seems fit for a performance bug report. I have to create a synthetic benchmark that shows just the problem. https://issues.dlang.org/show_bug.cgi?id=13410 (Perhaps I have credited the wrong person there, sorry, I will fix). Bye, bearophile

Re: A significant performance difference

2014-09-01 Thread bearophile via Digitalmars-d-learn
, and x.getAndRemove() too, it's handy sometimes. but this will need new druntime hook, i think. ;-) x.pop() sounds nicer :-) Bye, bearophile

Re: I can ask questions about dmd on windows here in this forum?

2014-08-31 Thread bearophile via Digitalmars-d-learn
Ali Çehreli: Unless there is a specific reason not to, use 'string'. When you really need random access to characters, then use 'dstring'. So are the use cases for wstring limited? Bye, bearophile

A significant performance difference

2014-08-31 Thread bearophile via Digitalmars-d-learn
much faster than the D code. Is it possible to fix the D code to increase its performance (there are associative array libraries for D, but I have not tried them in this program). Bye, bearophile

Re: How to compare two types?

2014-08-31 Thread bearophile via Digitalmars-d-learn
Adam D. Ruppe: If you want to compare the runtime type of a class object, you can do: if(typeid(obj_one) == typeid(obj_two)) that should tell you if they are the same dynamic class type. And what about: if (is(typeof(obj_one) == typeof(obj_two))) Bye, bearophile

Re: Benchmarking build times

2014-08-29 Thread bearophile via Digitalmars-d
templates, so if you don't add their main function, nothing gets compiled. Bye, bearophile

Re: literate programming in D

2014-08-29 Thread bearophile via Digitalmars-d-learn
nikki: I use it to change my d sourcefile slightly (into valid markdown) then I use a node module (ghmd) to make sortof sexy html from that. Are you going to add popups of the types as in the F# page I have linked? Bye, bearophile

Friendly-C

2014-08-28 Thread bearophile via Digitalmars-d
think that an overlapping memcpy ought to result in unspecified garbage being written rather than undefined behavior. Bye, bearophile

Re: Benchmarking build times

2014-08-28 Thread bearophile via Digitalmars-d
that need to be compiled. Bye, bearophile

Re: RFC: scope and borrowing

2014-08-27 Thread bearophile via Digitalmars-d
] + 2]s; return sum(a2[]); } Bye, bearophile

Re: Issue with dmd 2.066, alias this, and sort

2014-08-27 Thread bearophile via Digitalmars-d-learn
call impure function 'temp.Point.feature' Bye, bearophile

Re: Before we implement SDL package format for DUB

2014-08-26 Thread bearophile via Digitalmars-d
Jonathan Marler: What are DSLs? Link? http://en.wikipedia.org/wiki/Domain-specific_language Bye, bearophile

Re: Are there any exercises/challenges for D?

2014-08-26 Thread bearophile via Digitalmars-d-learn
maik klein: Are there any exercises/challenges for D? Some exercises here: http://rosettacode.org/wiki/Reports:Tasks_not_implemented_in_D Please announce them here when you solve some of them :-) Bye, bearophile

Re: literate programming in D

2014-08-26 Thread bearophile via Digitalmars-d-learn
the time: gist.github.com/nooodl/e23337d0175ad66ea5f0 Or F# ones: http://tomasp.net/blog/2014/puzzling-fsharp/ Bye, bearophile

Re: RFC: scope and borrowing

2014-08-25 Thread bearophile via Digitalmars-d
is possible without doing flow control or interprocedural analysis. I remember that Walter has recently said that he's willing to add some kind of flow analysis to the D front-end. Bye, bearophile

Re: RFC: scope and borrowing

2014-08-25 Thread bearophile via Digitalmars-d
comments from a good Rust core developer, because they have discussed such topics in detail for lot of time :-) Bye, bearophile

Re: unclear compile error for struct with string template

2014-08-25 Thread bearophile via Digitalmars-d-learn
); } (Note that in D the names of types and structs start with an upper case). Bye, bearophile

Re: Error with constraints on a templated fuction

2014-08-25 Thread bearophile via Digitalmars-d-learn
Jeremy DeHaan: It compiles if I remove the 'if(typeof(T) is dchar)' section. Any thoughts? Try: if (is(T == dchar)) Bye, bearophile

Re: D for the Win

2014-08-24 Thread bearophile via Digitalmars-d-announce
, bearophile

Re: How to get nogc to work with manual memory allocation

2014-08-24 Thread bearophile via Digitalmars-d-learn
the protection violation Don't use delete, it's deprecated (despite it's not yet deprecated because D designers love to keep some important things in such Limbo for several years). Bye, bearophile

<    2   3   4   5   6   7   8   9   10   11   >