Re: buffer to struct type conversion...TArrayStream?

2015-03-20 Thread Kagamin via Digitalmars-d-learn
If you don't want to run into alignment issues, you shouldn't cast the buffer directly: http://dpaste.dzfl.pl/b522f911871a

Text UI for D?

2015-03-20 Thread DLearner via Digitalmars-d-learn
Does D have a recommended package for this - like (n)curses for C?

Re: Lazy functions, lazy arrays

2015-03-20 Thread John Colvin via Digitalmars-d-learn
On Friday, 20 March 2015 at 10:02:27 UTC, Dennis Ritchie wrote: For example, lazy int sum(int a = 3, int b = 5) { return a + b; } That is, if the function is not invoked, it should not be calculated at compile time. I don't understand what you mean. You mean a function that isn't

Re: Should this work: export extern(C) auto ...

2015-03-20 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-03-19 13:22:44 +, Benjamin Thaut said: Generally don't expect to many things to work with DLLs at the moment. Hi, well, I think what's available is good enough to get most things done. Generally speaking only exporting global functions works. Don't try to export classes /

Re: Text UI for D?

2015-03-20 Thread John Colvin via Digitalmars-d-learn
On Friday, 20 March 2015 at 10:29:45 UTC, DLearner wrote: Does D have a recommended package for this - like (n)curses for C? You could just use nurses: https://github.com/D-Programming-Deimos/ncurses

Re: Text UI for D?

2015-03-20 Thread Suliman via Digitalmars-d-learn
On Friday, 20 March 2015 at 10:29:45 UTC, DLearner wrote: Does D have a recommended package for this - like (n)curses for C? http://stackoverflow.com/questions/29061809/tui-text-user-interface-for-d

Re: Lazy functions, lazy arrays

2015-03-20 Thread Dennis Ritchie via Digitalmars-d-learn
For example, lazy int sum(int a = 3, int b = 5) { return a + b; } That is, if the function is not invoked, it should not be calculated at compile time.

Re: final methods by default

2015-03-20 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, 20 Mar 2015 22:11:51 + weaselcat via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 20 March 2015 at 14:25:22 UTC, ref2401 wrote: Why aren't methods of class final by default? history use final class, it should devirtualize all methods. see:

Re: final methods by default

2015-03-20 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, 20 Mar 2015 16:27:04 -0700 Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, March 20, 2015 23:53:14 Daniel Kozak via Digitalmars-d-learn wrote: On Fri, 20 Mar 2015 22:11:51 + weaselcat via Digitalmars-d-learn

Re: final methods by default

2015-03-20 Thread Dude via Digitalmars-d-learn
On Friday, 20 March 2015 at 23:47:37 UTC, Daniel Kozak wrote: On Fri, 20 Mar 2015 16:27:04 -0700 Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, March 20, 2015 23:53:14 Daniel Kozak via Digitalmars-d-learn wrote: On Fri, 20 Mar 2015 22:11:51

Re: final methods by default

2015-03-20 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, March 20, 2015 23:53:14 Daniel Kozak via Digitalmars-d-learn wrote: On Fri, 20 Mar 2015 22:11:51 + weaselcat via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: On Friday, 20 March 2015 at 14:25:22 UTC, ref2401 wrote: Why aren't methods of class final by

Re: Lazy functions, lazy arrays

2015-03-20 Thread Tobias Pankrath via Digitalmars-d-learn
On Friday, 20 March 2015 at 12:15:22 UTC, Dennis Ritchie wrote: On Friday, 20 March 2015 at 10:38:17 UTC, John Colvin wrote: I don't understand what you mean. You mean a function that isn't compiled if it isn't used anywhere? Yes. That's exactly what I mean. Use case?

Re: final methods by default

2015-03-20 Thread John Colvin via Digitalmars-d-learn
On Friday, 20 March 2015 at 14:25:22 UTC, ref2401 wrote: Why aren't methods of class final by default? Because of a design choice to maximise usage flexibility that is questionable but not likely to change.

Re: Lazy functions, lazy arrays

2015-03-20 Thread John Colvin via Digitalmars-d-learn
On Friday, 20 March 2015 at 14:20:16 UTC, John Colvin wrote: On Friday, 20 March 2015 at 13:35:10 UTC, Dennis Ritchie wrote: Use case? No. I need to be able to make an array factorials is not evaluated, if I don't. import std.stdio; enum N = 15; static int[] factorials =

final methods by default

2015-03-20 Thread ref2401 via Digitalmars-d-learn
Why aren't methods of class final by default?

Re: Lazy functions, lazy arrays

2015-03-20 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 20 March 2015 at 10:38:17 UTC, John Colvin wrote: I don't understand what you mean. You mean a function that isn't compiled if it isn't used anywhere? Yes. That's exactly what I mean.

Re: Text UI for D?

2015-03-20 Thread Baz via Digitalmars-d-learn
On Friday, 20 March 2015 at 10:29:45 UTC, DLearner wrote: Does D have a recommended package for this - like (n)curses for C? I cannot recommend it because i've just found the package, it like Pascal turbo vision but in D. https://github.com/bbodi/dvision A few years ago someine else

Re: Lazy functions, lazy arrays

2015-03-20 Thread Dennis Ritchie via Digitalmars-d-learn
Use case? No. I need to be able to make an array factorials is not evaluated, if I don't. import std.stdio; enum N = 15; static int[] factorials = memoizeFactorials(N); // lazy array? :) int[] memoizeFactorials(int n) { if (!__ctfe) { // Make sure that this function is never

Re: Lazy functions, lazy arrays

2015-03-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 20 March 2015 at 12:52:16 UTC, Tobias Pankrath wrote: Use case? I do this with local imports so a module works without dependencies unless you use the specific functions that need the additional module.

Re: Lazy functions, lazy arrays

2015-03-20 Thread Tobias Pankrath via Digitalmars-d-learn
Now I am totally confused. lazy and eager evaluation are unrelated to compile time and run time.

Re: Text UI for D?

2015-03-20 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Mar 20, 2015 at 10:29:44AM +, DLearner via Digitalmars-d-learn wrote: Does D have a recommended package for this - like (n)curses for C? Try Adam Ruppe's excellent terminal.d -- I use it for my own TUI programs, and it's pretty good.

Re: How to replace the keyword nan to check the contract assert?

2015-03-20 Thread Ali Çehreli via Digitalmars-d-learn
On 03/20/2015 09:24 PM, Dennis Ritchie wrote: Hi, How do I replace double.init? import std.stdio : writeln; import std.algorithm : uninitializedFill; void main() { double[] arr = new double[6]; uninitializedFill(arr[0 .. $ - 2], 3.25); writeln(arr); assert(arr ==

Re: How to replace the keyword nan to check the contract assert?

2015-03-20 Thread Dennis Ritchie via Digitalmars-d-learn
On Saturday, 21 March 2015 at 04:53:20 UTC, Ali Çehreli wrote: nan cannot be used in comparisons. It is neither greater than nor less than any value. You cannot even compare it against itself. nan==nan would always be false. The solution is to call std.math.isNaN. In this case, you have to

How to replace the keyword nan to check the contract assert?

2015-03-20 Thread Dennis Ritchie via Digitalmars-d-learn
Hi, How do I replace double.init? import std.stdio : writeln; import std.algorithm : uninitializedFill; void main() { double[] arr = new double[6]; uninitializedFill(arr[0 .. $ - 2], 3.25); writeln(arr); assert(arr == [3.25, 3.25, 3.25, 3.25, double.init,

Re: Lazy functions, lazy arrays

2015-03-20 Thread John Colvin via Digitalmars-d-learn
On Friday, 20 March 2015 at 13:35:10 UTC, Dennis Ritchie wrote: Use case? No. I need to be able to make an array factorials is not evaluated, if I don't. import std.stdio; enum N = 15; static int[] factorials = memoizeFactorials(N); // lazy array? :) int[] memoizeFactorials(int n) {

Re: refactoring issues

2015-03-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 20 March 2015 at 18:05:07 UTC, Ivan Kazmenko wrote: Thanks. I was able to reproduce the workflow you showed in the gif to the part where an error pop-up (e.g. no property iota for type int) is followed by suggesting the appropriate fix. Do I need another tool for that? Colorout

Re: refactoring issues

2015-03-20 Thread Vladimir Panteleev via Digitalmars-d-learn
On Friday, 20 March 2015 at 18:36:19 UTC, Vladimir Panteleev wrote: On Friday, 20 March 2015 at 18:05:07 UTC, Ivan Kazmenko wrote: Thanks. I was able to reproduce the workflow you showed in the gif to the part where an error pop-up (e.g. no property iota for type int) is followed by

Re: Text UI for D?

2015-03-20 Thread ketmar via Digitalmars-d-learn
On Fri, 20 Mar 2015 10:29:44 +, DLearner wrote: Does D have a recommended package for this - like (n)curses for C? most of the time you don't really need a full-blown UI, but something to control the terminal and draw frames. ;-) Adam's module does that. signature.asc Description: PGP

OPTLINK Error 45 Too Much DEBUG Data for Old CodeView format

2015-03-20 Thread Koi via Digitalmars-d-learn
Hello, after some coding i needed to update some external libraries like DerelictSDL2. As we all know, one update isn't enough, so i updated my whole d-environment at the end of the day (current dmd version, VisualD). After getting rid of some linking errors (symbols undefined) i have only one

Re: refactoring issues

2015-03-20 Thread Ivan Kazmenko via Digitalmars-d-learn
On Thursday, 19 March 2015 at 16:06:31 UTC, Vladimir Panteleev wrote: On Thursday, 19 March 2015 at 14:32:53 UTC, Ivan Kazmenko wrote: Hey, I also happen to use Far Manager and its internal editor, at least for simple projects. Is that dcheck triggering a Far plugin? I have a bit of

Re: Lazy functions, lazy arrays

2015-03-20 Thread Dennis Ritchie via Digitalmars-d-learn
On Friday, 20 March 2015 at 14:27:06 UTC, John Colvin wrote: I made a mistake about the static variable and thread-local storage. immutable(int)[] factorials()() @property { static immutable int[N] results = memoizeFactorials(N); return results[]; } is the correct way to do it if you

Re: OPTLINK Error 45 Too Much DEBUG Data for Old CodeView format

2015-03-20 Thread Orfeo via Digitalmars-d-learn
You can refer to http://forum.dlang.org/post/jhbgaacoguxaubxgp...@forum.dlang.org Do you use dub? I resolved my problems (on Win) abandoning dub and using makefile. On Friday, 20 March 2015 at 17:35:19 UTC, Koi wrote: Hello, after some coding i needed to update some external libraries like

Re: Temple templates with vibe.d support and first D experiences

2015-03-20 Thread István Zólyomi
Still does not compile, thanks for the idea though. I think it's better to avoid Temple, compilation of Diet templates seems to be better anyway. E.g. temple seems to accept % var.nonexistingname % while diet gives a compile error for #{nonexistingname}. Meanwhile I figured out an easy way to

Re: final methods by default

2015-03-20 Thread Gary Willoughby via Digitalmars-d-learn
On Friday, 20 March 2015 at 14:25:22 UTC, ref2401 wrote: Why aren't methods of class final by default? See: http://forum.dlang.org/thread/lfqoan$5qq$1...@digitalmars.com

Re: final methods by default

2015-03-20 Thread weaselcat via Digitalmars-d-learn
On Friday, 20 March 2015 at 14:25:22 UTC, ref2401 wrote: Why aren't methods of class final by default? history use final class, it should devirtualize all methods. see: https://github.com/D-Programming-Language/dmd/pull/4427