Re: Memory Dump in D

2018-01-07 Thread codephantom via Digitalmars-d
On Sunday, 7 January 2018 at 11:05:01 UTC, H3XT3CH wrote: Hello i want to create a memory dump in D. The memory dump is for forensic usage so it must a dump of the complete ram. Can anyone help me ? I know that programms already exist that create correct dumps of my memory but i want to

Re: Templates for DRY code

2018-01-06 Thread codephantom via Digitalmars-d-learn
On Saturday, 6 January 2018 at 23:32:42 UTC, Paul Backus wrote: On Saturday, 6 January 2018 at 03:38:35 UTC, codephantom wrote: or even.. a.append( s.to!ConvertToElementType(a) ); That's not valid code of course, but the semantics are all contained in that single chunk. This works: import

Re: Templates for DRY code

2018-01-06 Thread codephantom via Digitalmars-d-learn
On Saturday, 6 January 2018 at 03:08:19 UTC, Ali Çehreli wrote: I agree with your point as well. A better name can help there a little. void ConvertAndAppend(T, S)(ref T[] arr, S s) { arr ~= s.to!T; } problem solved ;-) btw. I never thought that I would be able (or actually..willing)

Re: [OT] Flu shots

2018-01-05 Thread codephantom via Digitalmars-d
On Saturday, 6 January 2018 at 02:58:44 UTC, Walter Bright wrote: On 1/5/2018 7:00 AM, Steven Schveighoffer wrote: In any case, I still will not get one and probably won't until I'm in a nursing home and they make me :) You can get the flu and not show symptoms, and infect the people you're

Re: Templates for DRY code

2018-01-05 Thread codephantom via Digitalmars-d-learn
On Saturday, 6 January 2018 at 03:08:19 UTC, Ali Çehreli wrote: It's hard to find a balance between fully explicit and fully automatic. I find myself going back and forth between those two extremes. Ali Code is something that humans write and read (and read far more than write). So I

Re: What don't you switch to GitHub issues

2018-01-05 Thread codephantom via Digitalmars-d
On Friday, 5 January 2018 at 22:45:15 UTC, Walter Bright wrote: On 1/5/2018 3:04 AM, Paolo Invernizzi wrote: Adam suggested Walter to follow the 'learn' forum to have a cleaner idea about common problems in the language usage, and Walter replied that he prefers to invest his time digging  and

Re: Templates for DRY code

2018-01-05 Thread codephantom via Digitalmars-d-learn
On Saturday, 6 January 2018 at 01:33:11 UTC, Ali Çehreli wrote: One solution is to wrap ~= in a function template. Now the conversion is automatically made to the element type of the array: ... . I think append() could be a part of std.array but I can't find anything like that in Phobos.

Re: What don't you switch to GitHub issues

2018-01-05 Thread codephantom via Digitalmars-d
On Friday, 5 January 2018 at 13:22:00 UTC, Paolo Invernizzi wrote: - be quantitative: your download statistics are a good start, try to collect from commercials statistics about the length of the codebase, the compilation times, how many are using a feature (C++ integration, allocators,

Re: Some Observations on the D Development Process

2018-01-04 Thread codephantom via Digitalmars-d
On Friday, 5 January 2018 at 03:28:10 UTC, Walter Bright wrote: On 1/4/2018 2:34 AM, Mike Franklin wrote: Walter seems to pop in daily, and occasionally reviews PRs, and his PRs of late are mostly just refactorings rather than fixing difficult bugs. There's a lot of technical debt I've been

Re: Article: Finding memory bugs in D code with AddressSanitizer

2018-01-04 Thread codephantom via Digitalmars-d-announce
On Friday, 5 January 2018 at 01:32:50 UTC, Walter Bright wrote: On 1/3/2018 4:46 PM, Walter Bright wrote: On 1/3/2018 3:16 PM, Martin Nowak wrote: https://issues.dlang.org/show_bug.cgi?id=18190 This is a stack overflow caused by having 4096 expression statements. The compiler joins them

Forum Problmes

2018-01-04 Thread codephantom via Digitalmars-d
Is it just me, or are threads disappearing, and/or being posted to the wrong discussions?

Re: What don't you switch to GitHub issues

2018-01-04 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 18:27:37 UTC, H. S. Teoh wrote: So, one can choose to be part of the noise, or part of the real work. If you don't like the way certain things are done, then step up and do it differently. I hear this argument too much in the D community. It is not the solution

Re: What don't you switch to GitHub issues

2018-01-04 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 12:11:36 UTC, rjframe wrote: At the time of writing: Ansible has 3391 open bugs[1] (and ~master is often used in production). Python has more than 6000, 2000+ with patches[2]. GCC (C and C++ components only) has 3119[3]. Bugs are part of software. That's just

Re: load data from txt file

2018-01-04 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 08:39:04 UTC, Tony wrote: OK, thanks. The removechars() note about deprecation said to use std.regex instead so I have been looking at that and after a struggle did make some use of std.regex.replaceAll. Reminded me of the famous Jamie Zawinski quote: "Some

Re: What don't you switch to GitHub issues

2018-01-04 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 07:47:41 UTC, H. S. Teoh wrote: It all comes down to who's doing the actual work vs. who's just telling others what they think they should be doing, which rarely, if ever, works. I think that view really needs to be challenged. Those who might be willing to

Re: Maybe D is right about GC after all !

2018-01-04 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 10:18:29 UTC, Dan Partelly wrote: Rust has a OS being written right now. Does D has ? Anyone ever wanted to use D to write a OS kernel, I doubt it. https://github.com/PowerNex/PowerNex https://github.com/Rikarin/Trinix Id rather use a nice language as D to

Re: What don't you switch to GitHub issues

2018-01-03 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 06:39:24 UTC, Mike Parker wrote: I have an idea I'm working on to potentially help get older bugs squashed and older PRs merged. I need to hash out the details before getting it going, but I'll blog about when (and if) it comes to fruition. There are no

Re: What don't you switch to GitHub issues

2018-01-03 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 06:39:24 UTC, Mike Parker wrote: If you know how to get a bunch of volunteers with such varied interests to work in a concerted direction, please do tell. This is the mystery behind everything in the universe. Why haven't you solved it yet?

Re: How do you use D?

2018-01-03 Thread codephantom via Digitalmars-d
On Friday, 28 July 2017 at 14:58:01 UTC, Ali wrote: How do you use D? Every programming language has an effect on how programmers think. I use D to explore different ways of thinking. Did you introduce D to your work place? How? What challenges did you face? My work place is my home ;-) I

Re: What don't you switch to GitHub issues

2018-01-03 Thread codephantom via Digitalmars-d
On Thursday, 4 January 2018 at 05:28:40 UTC, IM wrote: To clarify, I too like D. It is certainly very pleasant to work with. This post wasn't about GitHub issues vs Bugzilla. That was a get-off-at-a-tangent topic. This post is about what's needed for a more mature D; mature enough for

Re: load data from txt file

2018-01-03 Thread codephantom via Digitalmars-d
On Wednesday, 3 January 2018 at 05:45:32 UTC, Tony wrote: Someone else should know what the correct replacement is for removechars(). the replacement is known as 'programming' ;-) //string trimmed = removechars!string(line,"[\\[\\]\"\n\r]"); string trimmed; foreach(c; line) { if(c !=

Re: Maybe D is right about GC after all !

2018-01-01 Thread codephantom via Digitalmars-d
On Tuesday, 2 January 2018 at 00:34:57 UTC, Nerve wrote: I would simply add that the strongest vocalizations come from those with objections. The silent majority that is perfectly okay with GC and gets huge development complexity reductions thanks to it rarely spare the energy to argue

Re: What do you want to see for a mature DLang?

2017-12-31 Thread codephantom via Digitalmars-d
On Sunday, 31 December 2017 at 21:16:35 UTC, Walter Bright wrote: On 12/31/2017 8:18 AM, IM wrote: What do you think? Do you agree that a process is needed? We've tried adding process before. It does not work, for the simple reason that it requires a dedicated group of people to dedicate

Re: Slices and Dynamic Arrays

2017-12-30 Thread codephantom via Digitalmars-d-learn
On Sunday, 31 December 2017 at 03:57:17 UTC, Tony wrote: On Sunday, 31 December 2017 at 03:08:05 UTC, Ivan Trombley wrote: double[] D = [3.14159]; Can you guess what D is? :D It took me a while but I finally came up with "a slice of pi" a slice of pi is irrational.

Re: What do you want to see for a mature DLang?

2017-12-30 Thread codephantom via Digitalmars-d
On Sunday, 31 December 2017 at 02:06:03 UTC, Iain Buclaw wrote: 2. Feel free to look at the list of regressons. https://issues.dlang.org/buglist.cgi?bug_severity=regression=dmd_id=218477_format=advanced=--- "This list is too long for Bugzilla's little mind" Mmm..just imagine how our

Re: D as a betterC a game changer ?

2017-12-30 Thread codephantom via Digitalmars-d
On Saturday, 30 December 2017 at 21:40:29 UTC, Adam Wilson wrote: This is not true. I was at DConf one year (can't remember which) and I watched the representative of one of D's larger corporate users do everything but actually get on his knees and beg Walter to make a breaking change. IIRC

Re: What do you want to see for a mature DLang?

2017-12-30 Thread codephantom via Digitalmars-d
On Saturday, 30 December 2017 at 16:36:57 UTC, Iain Buclaw wrote: All open issues are actionable, and require some action. They are not noise, and many issues whose fix requires a change in language specification or semantics are understandably left to the few who have the authoritative to

Re: D downloads

2017-12-29 Thread codephantom via Digitalmars-d
On Saturday, 23 December 2017 at 21:04:52 UTC, Laeeth Isharc wrote: http://erdani.com/d/downloads.daily.png Bad data, one off spike, or something else? https://successfulsoftware.net/2015/05/14/the-mystery-of-the-chinese-downloads/

Re: What do you want to see for a mature DLang?

2017-12-29 Thread codephantom via Digitalmars-d
On Friday, 29 December 2017 at 23:32:45 UTC, Walter Bright wrote: ... 3. Ideally there'd be a url one could click on, not an error code. No URLs! (unless they point to 'local' documentation). I do not want to become even more dependent on having access to the internet, in order to

Re: Finding unsafe line of code

2017-12-29 Thread codephantom via Digitalmars-d-learn
On Friday, 29 December 2017 at 09:38:50 UTC, Vino wrote: Let me re-frame the question with an example, as the Dsafe the below line of code is considered as unsafe(Pointer arithmetic), so let imagine that we have several similar line of code, how do we find such unsafe line, does the

Re: What do you want to see for a mature DLang?

2017-12-29 Thread codephantom via Digitalmars-d
On Friday, 29 December 2017 at 07:53:51 UTC, IM wrote: I will start: I will add: // -- module test; import std.stdio; @safe void main() { writeln("I'd like to see @safe as being the default"); } //

Re: Finding unsafe line of code

2017-12-29 Thread codephantom via Digitalmars-d-learn
On Friday, 29 December 2017 at 08:21:10 UTC, Vino wrote: Hi All, Is there a way to find or test which line of a give code is not safe(possible memory corruption). From, Vino.B That question needs to be refined ;-)

Re: Maybe D is right about GC after all !

2017-12-29 Thread codephantom via Digitalmars-d
On Friday, 29 December 2017 at 07:54:53 UTC, Mengu wrote: On Friday, 29 December 2017 at 00:26:04 UTC, codephantom wrote: On Thursday, 28 December 2017 at 08:53:25 UTC, Russel Winder wrote: [...] I disagree. [...] syntax is not weird at all. it is ML-ish. oh. I didn't know.. in any

Re: Maybe D is right about GC after all !

2017-12-28 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 10:54:08 UTC, Russel Winder wrote: If you want to believe that fine. Clearly you are missing the point I am making, which clearly must be my fault for bad expression. Also clear it is not worth progressing this debate. You are asking Walter to 'quantify'

Re: Maybe D is right about GC after all !

2017-12-28 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 11:27:29 UTC, Russel Winder wrote: However, in the end, the GStreamer core people know C, C++ a bit, D not at all. I suspect even if the choice had been Rust or D, Rust would have been chosen because it has no GC and D is a GC language. That is a little

Re: Maybe D is right about GC after all !

2017-12-28 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 10:57:55 UTC, Russel Winder wrote: Not sure which country this is an observation on, but again all countries are different so a global opinion is not possible. The problem in the UK is the shift from wholly government funded tertiary education, to partially

Re: Maybe D is right about GC after all !

2017-12-28 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 08:53:25 UTC, Russel Winder wrote: On Thu, 2017-12-28 at 03:34 +, codephantom via Digitalmars-d wrote: […] I tried Go. I didn't like it. Syntax changes were not I looked at Rust, but never tried it, as I found the syntax to pretty awful - and it reminded

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 04:49:04 UTC, Walter Bright wrote: On 12/27/2017 8:29 AM, Russel Winder wrote: This does not support the original claim that the design of D by you is based on psychology. It may be based on your perception of other programmers needs, which is fine per se, but

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 13:37:17 UTC, Adam D. Ruppe wrote: On Wednesday, 27 December 2017 at 10:10:03 UTC, Pawn wrote: It's been expressed that there are now too many codebases such that introducing "breaking changes" would upset many people and companies. D is a mature language, not

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 02:53:56 UTC, Dan Partelly wrote: On Thursday, 28 December 2017 at 02:48:11 UTC, codephantom wrote: https://www.youtube.com/watch?v=vYEKEIpM2zo Thanks Ill watch it, but when I mentioned worse is better I didn't had C++ in mind. I thought at new language who

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 02:39:58 UTC, Dan Partelly wrote: Id wish things would be so simple. Unfortunately, no, there is no void to be filled by a monopoly here. It's a place full of competition, and to gain a spot (not bene, a spot, the monopoly doesnt exist) you have to

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 02:28:20 UTC, Dan Partelly wrote: This is marketing. Many times in marketing questions are used to try to pass a certain perspective as a fact to the target population. You guys here are all pretty smart, so prolly you all seen it ;-) Yeah, true.. but

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 02:21:09 UTC, Dan Partelly wrote: Small snippets. I believe is the best way to start with a new language. Then you decide if you like it, and if it serves any purpose for you. Adopting a new language for anything serious is a big commitment. This is what I

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 00:36:32 UTC, Dan partelly wrote: Can you find a similar void today which is to be filled by D ? Better yet can you create one ? No need to create one. It already exists. The need for highly flexible, portable, powerful, fast, compiled language, that is easy

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 20:24:04 UTC, Walter Bright wrote: This illustrates my point if it was unclear: C++: int foo(int* p) { return p[1]; } int bar(int i) { return foo(); } clang++ -c test.cpp -Wall D: @safe: int foo(int* p) { return p[1]; } int bar(int

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Thursday, 28 December 2017 at 00:16:39 UTC, Walter Bright wrote: Phobos has undergone several waves of grand renaming. At some point this has to stop and we need stability. There is nothing better for a progamming language than stability. There is nothing worse for a progamming language

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 18:32:43 UTC, Dan Partelly wrote: On Wednesday, 27 December 2017 at 16:46:18 UTC, Russel Winder wrote: (*) "Better C" is a specialist use case for Walter and the D backend. Also, if betterC is a specialist use case for Walter only, why does Walter call

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 19:42:50 UTC, Dan Partelly wrote: Im not here to save the world , the baby seals , or D (if it needs saving), or whatever other crusade. Im here because Im curious about D, curious enough to want to know future direction and what the bright people around here

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 10:10:03 UTC, Pawn wrote: It's been expressed that there are now too many codebases such that introducing "breaking changes" would upset many people and companies. D is a mature language, not a young one. To that.. I say...tuff ;-) A breaking change

Re: D as a betterC a game changer ?

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 08:59:10 UTC, Dan Partelly wrote: The D personality is mixed: ... I think stating it that way implies some kind of psychopathology ;-) It would be better, and more accurate, to state that 'The D personality has had to evolve over a long period of time'.

Re: Maybe D is right about GC after all !

2017-12-27 Thread codephantom via Digitalmars-d
On Wednesday, 27 December 2017 at 07:49:33 UTC, Walter Bright wrote: AS is a hackish workaround for the failure of the language to prevent such things. AS is just a more modern valgrind, which has been around for ages, and has failed to turn C/C++ into memory safe languages. Well, I don't

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 15:53:50 UTC, Russel Winder wrote: Sadly I cannot see either of these happening. There is already too much to pack in to an undergraduate CS (*) course even if first programming and simple algorithms moves out into pre-university education – as has now

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 16:50:54 UTC, Dan Partelly wrote: Ok I'll bite. Can you recommend me some reasonable easy literature. Something you can read in free time when you travel, not study. Social interactions where always interesting for me.

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 22:56:40 UTC, Walter Bright wrote: On 12/26/2017 3:54 AM, codephantom wrote: I simply have to 'forget' to annotate with @safe Not annotating with @safe is mechanically checkable as well. If I were trying to create a marketing campaign for D, as being a safe

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 22:55:18 UTC, Walter Bright wrote: I compiled the code snippet with clang++, a modern C++ compiler, with -Wall. It did not detect the obvious error. https://clang.llvm.org/docs/AddressSanitizer.html

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 12:18:09 UTC, Russel Winder wrote: All of which brings us full circle: when it comes to programming languages and software development, it is all about advocacy, prejudice, and belief, there is very, very little science happening – and most of the science that

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 10:00:25 UTC, Paolo Invernizzi wrote: IMHO, the lost list of vulnerability in code shipped by "first class enterprises" is just crying out that C/C++ is not mechanically checkable. And we are talking about company that can literally spend an Everest of money on

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 09:03:31 UTC, Paolo Invernizzi wrote: The point is that the presence of one @safe: line in the module can be mechanically checked, over one million devs working on a codebase. The whole point of Walter argumentation is 'mechanically'. /Paolo My C/C++ code

Re: Maybe D is right about GC after all !

2017-12-26 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 07:33:18 UTC, Mark wrote: Then whoever is using your code (you?) will find that out when they call your functions from a @safe function. And if they forget to annotate their so called 'safe' function with @safe...what happens then? Comparing the 'memory

Re: Maybe D is right about GC after all !

2017-12-25 Thread codephantom via Digitalmars-d
On Tuesday, 26 December 2017 at 04:47:35 UTC, Walter Bright wrote: Only if someone considers this as fixed: int foo(int* p) { return p[1]; } int bar(int i) { return foo(); } clang++ -c test.cpp -Wall good example..and it makes a good point. however, let that point be not that

Re: Maybe D is right about GC after all !

2017-12-23 Thread codephantom via Digitalmars-d
On Friday, 22 December 2017 at 15:23:51 UTC, Russel Winder wrote: I think we are now in a world where Rust is the zero cost abstraction language to replace C and C++, except for those who are determined to stay with C++ and evolve it. Well..there are plenty who are determined to stay with

Re: Maybe D is right about GC after all !

2017-12-21 Thread codephantom via Digitalmars-d
On Tuesday, 19 December 2017 at 09:54:05 UTC, Walter Bright wrote: "C, Python, Go, and the Generalized Greenspun Law" http://esr.ibiblio.org/?p=7804 The question that remains, is how scalable and tunable is "D's GC implementation" to my programming needs (whatever they might happen to be).

Re: Maybe D is right about GC after all !

2017-12-21 Thread codephantom via Digitalmars-d
On Wednesday, 20 December 2017 at 18:28:20 UTC, Ali Çehreli wrote: I think it's a psychological phenomenon worthy of scientific interest how a craft with so many guidelines can still be accepted. Actually, the 'core guidelines' is itself a psychological phenomenon of interest, given that

Throwing away microseconds

2017-12-21 Thread codephantom via Digitalmars-d
Know what you're throwing away, when you throw away microseconds. 984 feet! https://www.youtube.com/watch?v=9eyFDBPk4Yw=youtu.be

Re: No of threads

2017-12-20 Thread codephantom via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 13:41:06 UTC, Vino wrote: Hi Ali, Thank you very much, below are the observations, our program is used to calculate the size of the folders, and we don't see any improvements in the execution speed from the below test, are we missing something. Basically

Re: DateTime formatting

2017-12-20 Thread codephantom via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 14:30:55 UTC, bauss wrote: I can't seem to find anything in Phobos that allows you to specify custom formats for dates. sometimes it's just better to take control of things yourself ;-) https://forum.dlang.org/post/dmxdtciktpggcxybd...@forum.dlang.org

tuples from text file

2017-12-19 Thread codephantom via Digitalmars-d-learn
so I have a text file containing 3 lines(e.g): 5, "hello", 4.3 "hello", 4.3 "hello", "world", 1, 2, 3, 5.5 Now I want to create tuples from each line. However, (using line 1 as example), I get: Tuple!string("5, \"hello\", 4.3") but I really want: Tuple!(int, string, double)(5, "hello", 4.3)

Re: No of threads

2017-12-19 Thread codephantom via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 10:24:47 UTC, Vino wrote: foreach (d; taskPool.parallel(xxx,20)) : As in Windows 2008 whatever value is set for the parallel the total number of threads does not increase more than 12. So not sure if this is correct, so can any one explain me on same.

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Tuesday, 19 December 2017 at 01:30:07 UTC, Mike Franklin wrote: writeln(S.j); // Error: Instance symbols cannot be used through types. I don't understand why you would say that is a bug. i.e. // import std.stdio; struct S { int j; } void main() {

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: alias a = s.i; // illegal, s.i is an expression Actually, as I understand it, the example provided in 10. is legal (because it aliases a type), and the example provided in 3. is illegal (because it aliases an expression) perhaps

Re: Alias example should supposedly be illegal, but runs fine

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Monday, 18 December 2017 at 23:44:46 UTC, Michael wrote: alias a = s.i; // illegal, s.i is an expression alias a = s.i; (this is an alias to a type, since s.i is an int) Hence it is actually 'legal', as far as I understand. i.e... "AliasDeclarations create a symbol that is an alias for

Re: Array Template

2017-12-18 Thread codephantom via Digitalmars-d-learn
On Saturday, 16 December 2017 at 14:14:28 UTC, Vino wrote: Yes, will give a try. From, Vino.B well, this sort of gets there ;-) // - module test; import std.stdio; import std.variant; import std.typecons; import std.conv; import std.string; void main() { Variant[] arr; auto

Re: Where is sleep()?

2017-12-17 Thread codephantom via Digitalmars-d-learn
On Sunday, 17 December 2017 at 08:32:20 UTC, Ryan David Sheasby wrote: Hey guys. First time poster here. I've searched high and low but can't seem to find a simple sleep/delay/wait/pause function in the core or in phobos. The most recent information I can find about it is this forum post from

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-17 Thread codephantom via Digitalmars-d-learn
On Sunday, 17 December 2017 at 08:26:03 UTC, Jonathan M Davis wrote: assert(0) does indeed turn into a HLT instruction in -release mode (as does any assertion that's known to be false at compile time). It's a special case intended for marking code that's supposed to be unreachable. Without

Re: Scope failure is not preventing application crush in case of uncaught exceptions

2017-12-17 Thread codephantom via Digitalmars-d-learn
On Sunday, 17 December 2017 at 00:10:27 UTC, Anonymouse wrote: If you return inside a scopeguard though, the exception (or error!) is swallowed. https://run.dlang.io/is/GEtQ6D The scope guard will not 'swallow' it, if you use -release mode. Which suggests to me, that assert(0) operates

Re: Array Template

2017-12-15 Thread codephantom via Digitalmars-d-learn
On Friday, 15 December 2017 at 17:21:55 UTC, Vino wrote: Hi All, Request your help, Is it possible to an template array something similar as below so that we can insert any type of value(string, int etc). If possible can you provide me a example of how to define such array.

Re: How to catch line number of exception without catching it ?

2017-12-13 Thread codephantom via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 18:24:09 UTC, Thomas wrote: Or is there a better solution for tracing the error position from root till the branch ? Speaking of tracing exceptions, here's my favourite one .. so far ;-) (I mean come on.. debugging is great fun!) btw. If you compile/run

Re: Date Formating

2017-12-13 Thread codephantom via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 07:35:40 UTC, Jonathan M Davis wrote: In general, you probably want to cast the SysTime to a DateTime if you're going to do something like that. yes, I would agree ;-) Of course the intention was not really to just format it the same way as Clock.currTime()

Re: Understanding how dub works

2017-12-12 Thread codephantom via Digitalmars-d-learn
On Tuesday, 12 December 2017 at 22:20:41 UTC, datboi wrote: Hi, I'm learning D (obliviously) learning D in an oblivious manner can be difficult ;-)

Re: Date Formating

2017-12-12 Thread codephantom via Digitalmars-d-learn
On Tuesday, 12 December 2017 at 15:56:59 UTC, Vino wrote: Hi All, Request out help on date formatting, I have code which output the date and time as below , i we need it without the last few numbers.,ie "-MMM-DD HH:MM:SI" Output : 2017-Sep-06 16:06:42.7223837 Required Output :

Re: Why is there no std.stream anymore?

2017-12-11 Thread codephantom via Digitalmars-d-learn
On Tuesday, 12 December 2017 at 02:15:13 UTC, codephantom wrote: just playing around with this also...in case you only want to read n bytes.. // --- module test; import std.stdio, std.file, std.exception; import std.datetime.stopwatch; void main() { string

Re: Why is there no std.stream anymore?

2017-12-11 Thread codephantom via Digitalmars-d-learn
On Monday, 11 December 2017 at 20:51:41 UTC, Jordi Gutiérrez Hermoso wrote: I'd like to read from a file, one byte at a time, without loading the whole file in memory. just playing around with this // module test; import std.stdio, std.file, std.exception; void

Re: Sort in return statement

2017-12-09 Thread codephantom via Digitalmars-d-learn
On Saturday, 9 December 2017 at 14:49:28 UTC, Seb wrote: randomSample doesn't sort its returned range Not by design, however, because it samples in the order that the elements appear, *if* those elements are already sorted (whether by design or explicately sorted), then the results of the

Re: Sort in return statement

2017-12-09 Thread codephantom via Digitalmars-d-learn
On Saturday, 9 December 2017 at 14:18:00 UTC, Seb wrote: Yeah, you are very welcome. It's a bit hidden in the docs: Yes. Thanks for that. After lots of reading, and testing, I managed to get a simple, one liner ;-) (doesn't seem like .release is needed though.) // --- auto

Re: Sort in return statement

2017-12-08 Thread codephantom via Digitalmars-d-learn
On Saturday, 9 December 2017 at 04:31:33 UTC, SimonN wrote: Yes, this works, and your algorithm would even accept arbitary random-access ranges, not merely arrays. Would be nice if I could do it all as a 'one liner': // int[] draw8Numbers() { import std.algorithm.sorting :

Re: Sort in return statement

2017-12-08 Thread codephantom via Digitalmars-d-learn
On Saturday, 9 December 2017 at 02:45:35 UTC, rjframe wrote: `sort` returns a SortedRange of ushorts, not an array of ushorts. Make it: ``` import std.array : array; return sort(numbers.take(8)).array; ``` --Ryan That's it! Thanks Ryan.

Re: Check whether a file is empty.

2017-12-08 Thread codephantom via Digitalmars-d-learn
On Friday, 8 December 2017 at 19:13:20 UTC, vino wrote: Hi, The code is same just copy pasted the code form Windows 7 into Windows 2003 and executed, in Windows 7 the log file is of size 0 where as in windows 2003 the log file is of size 2 byte where the log file in both the server is

Sort in return statement

2017-12-08 Thread codephantom via Digitalmars-d-learn
Anyone got ideas on how to get sort() working in the *return* statement? // ushort[] draw8Numbers() { import std.meta : aliasSeqOf; import std.range : iota; ushort[] numbers = [ aliasSeqOf!(iota(1,46)) ]; import std.random : randomShuffle;

Re: Optimizing a bigint fibonacci

2017-12-06 Thread codephantom via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:59:12 UTC, codephantom wrote: On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote: This is question not directly related to language concepts, it's got more to do with the application. I would appreciate if anyone would point to me how I could

Re: Optimizing a bigint fibonacci

2017-12-06 Thread codephantom via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:12:08 UTC, helxi wrote: This is question not directly related to language concepts, it's got more to do with the application. I would appreciate if anyone would point to me how I could optimize this bit of code Compile it with ldc ;-)

Re: lower case only first letter of word

2017-12-06 Thread codephantom via Digitalmars-d-learn
On Tuesday, 5 December 2017 at 13:31:17 UTC, Marc wrote: Does D have a native function to capitalize only the first letter of the word? (I'm asking that so I might avoid reinvent the wheel, which I did sometimes in D) // module test; import std.stdio; void main() {

Re: Passing Function as an argument to another Function

2017-12-04 Thread codephantom via Digitalmars-d-learn
On Monday, 4 December 2017 at 11:30:02 UTC, codephantom wrote: On Monday, 4 December 2017 at 11:05:22 UTC, Vino wrote: The original program is as below Error: FunTest.d(52): Error: template FunTest.ptProcessFiles cannot deduce function from argument types !()(string, Array!(Tuple!(string,

Re: Passing Function as an argument to another Function

2017-12-04 Thread codephantom via Digitalmars-d-learn
On Monday, 4 December 2017 at 11:05:22 UTC, Vino wrote: The original program is as below Error: FunTest.d(52): Error: template FunTest.ptProcessFiles cannot deduce function from argument types !()(string, Array!(Tuple!(string, string)) function(string FFs, string Step, int DirAged), File,

Re: First Impressions!

2017-12-02 Thread codephantom via Digitalmars-d
On Sunday, 3 December 2017 at 01:11:14 UTC, codephantom wrote: but my wider point is, unicode emoji's are useless if they only contain those that 'some' consider to be polictically correct, or socially acceptable. The Unicode consortium is a bunch of ... (I don't have the unicode emoji

Re: Windows Share Path

2017-12-02 Thread codephantom via Digitalmars-d-learn
On Saturday, 2 December 2017 at 14:23:48 UTC, Vino wrote: Hi, Even tried the Option "Run with Highest Privilege" but no luck. and also tried with option "Configure for : Windows Vista , Windows Server 2008" From, Vino.B You haven't accidently ticked the 'Do not store password' option?

Re: First Impressions!

2017-12-02 Thread codephantom via Digitalmars-d
On Saturday, 2 December 2017 at 16:44:56 UTC, Ola Fosheim Grøstad wrote: On Saturday, 2 December 2017 at 12:25:22 UTC, codephantom wrote: Do the people on the unicode consortium consider such communication to be invalid?

Re: Windows Share Path

2017-12-02 Thread codephantom via Digitalmars-d-learn
On Saturday, 2 December 2017 at 07:48:14 UTC, Vino wrote: Even tried with the below code, it works manually but not via Windows scheduler with option "Run whether user is logged on or not" Are you using appropriate credentials in the scheduled task?

Re: First Impressions!

2017-12-02 Thread codephantom via Digitalmars-d
On Saturday, 2 December 2017 at 04:08:54 UTC, Jonathan M Davis wrote: The fact that they're then trying to put those pictures into the Unicode standard just blatantly shows that the Unicode folks have lost sight of what they're up to. It's like if they started trying to add Unicode

Re: Question on Dual-Licensing Some Code for Phobos

2017-12-01 Thread codephantom via Digitalmars-d
On Saturday, 2 December 2017 at 05:05:14 UTC, Jack Stouffer wrote: On Saturday, 2 December 2017 at 02:35:18 UTC, codephantom wrote: Just the fact that you've seen that source code, is enough to have already 'contaminated' you with that source code's licence, and, that could

Re: scope(exit) and Ctrl-C

2017-12-01 Thread codephantom via Digitalmars-d-learn
On Saturday, 2 December 2017 at 04:28:57 UTC, Wanderer wrote: Thanks! This works. But it seems a little bit suspicions that D's type for handler function has `nothrow` `@nogc` and `@system`. I wonder why is that? During execution of that handler, it make sense to prohibit the allocation of

  1   2   3   4   >