Re: Can't make inout work.

2019-03-18 Thread spir via Digitalmars-d-learn
On 17/03/2019 18:34, Kagamin via Digitalmars-d-learn wrote: On Saturday, 16 March 2019 at 14:57:35 UTC, Paul Backus wrote: This code fails to compile if you change `auto s2` to `const s2`--in other words, it has the same problem as the original example. Maybe there's not much need for

Re: Block statements and memory management

2019-03-16 Thread spir via Digitalmars-d-learn
On 16/03/2019 11:19, Dennis via Digitalmars-d-learn wrote: On Saturday, 16 March 2019 at 03:47:43 UTC, Murilo wrote: Does anyone know if when I create a variable inside a scope as in {int a = 10;} it disappears complete from the memory when the scope finishes? Or does it remain in some part of

Re: Can't make inout work.

2019-03-16 Thread spir via Digitalmars-d-learn
PS: the chapter of Ali Çehreli's book on func args is great: http://ddili.org/ders/d.en/function_parameters.html diniz

Re: Can't make inout work.

2019-03-16 Thread spir via Digitalmars-d-learn
On 16/03/2019 04:49, Paul Backus via Digitalmars-d-learn wrote: On Friday, 15 March 2019 at 23:57:15 UTC, aliak wrote: Anyone knows how to make this work? You need an explicit `inout` on the return value of `make`: auto ref make(T)(inout auto ref T value) {     return inout(S!T)(value); }

Re: local class instance (at module-level)

2019-03-14 Thread spir via Digitalmars-d-learn
On 15/03/2019 00:45, ag0aep6g via Digitalmars-d-learn wrote: On 14.03.19 20:43, Jacob Carlborg wrote: class C { uint i ; this (uint i) { this.i = i ; } this (uint i) shared { this.i = i ; } this (uint i) immutable { this.i = i ; }

Re: bug in doc?

2019-03-14 Thread spir via Digitalmars-d-learn
On 14/03/2019 15:52, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Mar 14, 2019 at 03:22:52PM +0100, spir via Digitalmars-d-learn wrote: https://dlang.org/spec/hash-map.html#static_initialization: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz&

Re: local class instance (at module-level)

2019-03-14 Thread spir via Digitalmars-d-learn
On 14/03/2019 12:16, H. S. Teoh via Digitalmars-d-learn wrote: On Thu, Mar 14, 2019 at 12:05:22PM +0100, spir via Digitalmars-d-learn wrote: I desperately try to declare/define/initialise a simple class instance at module-level. This is a special (conceptually static and immutable) instance

bug in doc?

2019-03-14 Thread spir via Digitalmars-d-learn
https://dlang.org/spec/hash-map.html#static_initialization: immutable long[string] aa = [ "foo": 5, "bar": 10, "baz": 2000 ]; ==> Error: non-constant expression `["foo":5L, "bar":10L, "baz":2000L]` Also: I don't understand the error message: * What is non-constant in the *expression*? *

local class instance (at module-level)

2019-03-14 Thread spir via Digitalmars-d-learn
I desperately try to declare/define/initialise a simple class instance at module-level. This is a special (conceptually static and immutable) instance used as a "marker", that just should exist and be accessible by methods of this class and/or other classes defined in the same module. (Thus I

Re: Why does D language do not support BigDecimal type?

2019-03-12 Thread spir via Digitalmars-d-learn
On 12/03/2019 10:31, Boqsc via Digitalmars-d-learn wrote: Please attach quick working examples for every sentence you write or it's just a waste of time. People want to see the results and direct actions first before anything else, it's more efficient communication. We are in the subforum of

Re: Distinguish float and integer types from string

2019-03-10 Thread spir via Digitalmars-d-learn
On 09/03/2019 19:11, Jacob Shtokolov via Digitalmars-d-learn wrote: The thing is that in PHP, for example, I would do The thing is php needs to be able to "lexify" raw input data at runtime, while in D this is done at compile-time. The ompiler has the lexer to do that. But I agree that, for

Re: this is null

2019-03-10 Thread spir via Digitalmars-d-learn
On 09/03/2019 21:10, ANtlord via Digitalmars-d-learn wrote: On Saturday, 9 March 2019 at 20:04:53 UTC, Paul Backus wrote: You can end up with a null `this` reference if you dereference a null pointer to a struct and then call a method on the result. For example: I can but my reference is

Re: 2 class issues -- PS

2019-03-07 Thread spir via Digitalmars-d-learn
from [https://dlang.org/spec/attribute.html#abstract] : --- abstract Attribute An abstract member function must be overridden by a derived class. Only virtual member functions may be declared abstract; non-virtual member functions and free-standing functions cannot be declared

2 class issues

2019-03-07 Thread spir via Digitalmars-d-learn
Hello, First, I am not very experimented with the combination of static lang (alloc & typing) and OO (class-based). I'm implementing a library for lexical analysis (lexing), with 2 minor issues: -1- How to enforce that subclasses implement given methods without using "abstract", which seems

Re: Beginner ?. Why does D suggest to learn java

2014-10-17 Thread spir via Digitalmars-d-learn
On 17/10/14 07:38, maarten van damme via Digitalmars-d-learn wrote: While d can be complex, there's nothing preventing you from starting out simple and not using all features at first. I don't understand why it's not suitable for a beginner if you use this approach... For some reasons, in my

Re: Beginner ?. Why does D suggest to learn java

2014-10-17 Thread spir via Digitalmars-d-learn
On 17/10/14 03:05, ketmar via Digitalmars-d-learn wrote: On Fri, 17 Oct 2014 00:52:14 + MachineCode via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: I don't understand. If at least it were C but java? why not D itself? C is *awful* as beginner's language. never ever let

Re: String created from buffer has wrong length and strip() result is incorrect

2014-10-17 Thread spir via Digitalmars-d-learn
On 17/10/14 09:29, thedeemon via Digitalmars-d-learn wrote: On Friday, 17 October 2014 at 06:29:24 UTC, Lucas Burson wrote: // This is where things breaks { ubyte[] buff = new ubyte[16]; buff[0..ATA_STR.length] = cast(ubyte[])(ATA_STR); // read the string back from the

Re: How to check i

2014-10-16 Thread spir via Digitalmars-d-learn
On 16/10/14 20:46, Uranuz via Digitalmars-d-learn wrote: I have some string *str* of unicode characters. The question is how to check if I have valid unicode code point starting at code unit *index*? [...] You cannot do that without decoding. Cheking whether utf-x is valid and decoding are

Re: opDispatch, duck typing, and error messages

2011-04-22 Thread spir
On 04/22/2011 12:24 AM, Adam D. Ruppe wrote: I just made an innocent little change to one of my programs, hit compile, and got this vomit: /home/me/d/dmd2/linux/bin/../../src/phobos/std/conv.d(97): Error: template std.conv.toImpl(T,S) if (!implicitlyConverts!(S, T) isSomeString!(T)

Re: opDispatch, duck typing, and error messages

2011-04-22 Thread spir
On 04/22/2011 01:25 AM, Adam D. Ruppe wrote: bearophile wrote: Maybe exceptions nature should be changed a little so they store __FILE__ and __LINE__ on default (exceptions without this information are kept on request, for optimization purposes). I'd like that. Even with a stack trace, it's

Re: opDispatch, duck typing, and error messages

2011-04-22 Thread spir
On 04/22/2011 03:53 AM, Robert Jacques wrote: On Thu, 21 Apr 2011 18:24:55 -0400, Adam D. Ruppe destructiona...@gmail.com wrote: [snip] Or, there's a whole new approach: e) Duck typing for ranges in to!() might be a bad idea. Again, remember, a class might legitimately offer a range interface,

Re: Hidden argument kind antipattern

2011-04-20 Thread spir
On 04/20/2011 01:42 AM, Kai Meyer wrote: On 04/19/2011 05:18 PM, dsimcha wrote: == Quote from Vladimir Panteleev (vladi...@thecybershadow.net)'s article To elaborate, I mean allowing code which appears to behave surprisingly different from the at-a-glance interpretation, unless the programmer

Re: postincrement behaviour (differences between dmd and gdc)

2011-04-20 Thread spir
On 04/20/2011 11:33 AM, Iain Buclaw wrote: This was partially discussed before some time ago - http://www.digitalmars.com/d/archives/digitalmars/D/postincrement_behaviour_differences_between_dmd_and_gdc_47334.html The following statement has different behaviours in dmd and gdc. int x; x =

use case for alias this

2011-04-20 Thread spir
Hello, For what it's worth, I have finally found one use case for the famous alias this trick for structs: struct ScienceConstant { float value; string name; alias value this; string toString () { return this.name; } } unittest { auto PI = ScienceConstant(3.14, pi);

Re: Hidden argument kind antipattern

2011-04-19 Thread spir
On 04/20/2011 01:09 AM, Vladimir Panteleev wrote: To elaborate, I mean allowing code which appears to behave surprisingly different from the at-a-glance interpretation, unless the programmer knows the function's signature. I've noticed a worrying adoption in D of this antipattern, which,

Re: Hidden argument kind antipattern

2011-04-19 Thread spir
On 04/20/2011 01:18 AM, dsimcha wrote: == Quote from Vladimir Panteleev (vladi...@thecybershadow.net)'s article To elaborate, I mean allowing code which appears to behave surprisingly different from the at-a-glance interpretation, unless the programmer knows the function's signature. I've

Re: lame question

2011-04-18 Thread spir
On 04/18/2011 10:31 AM, %u wrote: Is it necessary free memory allocated for member of structure, like in C? I suppose not (we have gc). Example: struct BITMAP { (...) ubyte[] pixels; } BITMAP* bitmap = new BITMAP; bitmap.pixels = new ubyte[100*100]; (...) // delete bitmap.pixels; //not

Re: A use case for fromStringz

2011-04-16 Thread spir
On 04/16/2011 06:55 AM, Andrej Mitrovic wrote: I wonder.. in all these years.. have they ever thought about using a convention in C where the length is embedded as a 32/64bit value at the pointed location of a pointer, followed by the array contents? Sometimes called Pascal strings (actually,

Re: LLVM Coding Standards

2011-04-15 Thread spir
On 04/15/2011 01:10 PM, Spacen Jasset wrote: As other posters have pointed out, it seems to me, at least, that having a way to express your model/idea or view of a problem directly is the most useful thing a language can give you. This is my definition of a good language :-) Denis --

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-14 Thread spir
On 04/13/2011 11:44 PM, Andrei Alexandrescu wrote: On 4/13/11 4:17 PM, Jérôme M. Berger wrote: Well, standard (printed) typographic practices put spaces outside the parenthesis and none inside. And as opposed to a lot of typographic rules, that one is a constant across languages and variants.

unittest{...} as free code bolck

2011-04-14 Thread spir
On 04/13/2011 10:38 PM, Andrei Alexandrescu wrote: Similarly, it would be great if next to e.g. http://d-programming-language.org/phobos-prerelease/std_algorithm.html#setUnion there would be a Try it now button. Clicking on that button would open an overlay with an edit window. The edit window

Re: Try it now

2011-04-14 Thread spir
On 04/13/2011 10:54 PM, Adam D. Ruppe wrote: Andrei wrote: Adam wrote an in-browser evaluator for D programs. These, when presented on the homepage with hello, world in them are of limited usefulness. However, a personalized try it now button present for _each_ artifact in an std module would

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 01:11 AM, bearophile wrote: * Since most of them don't actually output anything, the program now detects output.length == 0 and says Program run successfully. upon completion to give some feedback. This is a problem. Unittest code is not meant to produce an output, while

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 02:51 AM, Adam D. Ruppe wrote: Andrej Mitrovic wrote: I've always wondered.. how do you detect malicious D code? It doesn't. What it does is use the ulimit feature in linux to limit the resources available to each process so they can't do anything. Try it: int[] a; a.length =

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 02:56 AM, bearophile wrote: Andrei: I disagree. I find examples that use assert() much clearer than examples that print something to the console and then explain in a comment what you ought to be seeing. I don't understand why you say that. Isn't learning and understanding

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 02:56 AM, bearophile wrote: Andrei: I disagree. I find examples that use assert() much clearer than examples that print something to the console and then explain in a comment what you ought to be seeing. I don't understand why you say that. Isn't learning and understanding

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 06:32 AM, Walter Bright wrote: On 4/13/2011 6:04 PM, Adam D. Ruppe wrote: I don't know - I like the approach Andrei took in the docs, writing a series of true assertations. assert(sort([4, 2]) == [2, 4]); does look pretty neat. I guess the alternative is: writeln(sort[4, 2]);

Re: Ceylon language

2011-04-14 Thread spir
On 04/13/2011 02:34 PM, bearophile wrote: - Ceylon does not support method overloading (or any other kind of overloading). How to survive? Named args and default values somewhat mitigate this lack, but still... I read (somewhere) this only for /operator/ overloading.

single-line string?

2011-04-14 Thread spir
Hello, This may be a feature request for a single-line string syntactic form --if ever others are annoyed as well, see below. One possible form may be: str = sabc; I have myself long found it stupid to separate single- and multi-line string, since there is no formal reason for that. But

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 04:21 PM, Andrei Alexandrescu wrote: On 4/14/11 6:49 AM, spir wrote: On 04/14/2011 11:30 AM, Jacob Carlborg wrote: On 2011-04-13 22:38, Andrei Alexandrescu wrote: I'm quite excited about the new look of std (right now realized only by http://d-programming-language.org/phobos

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 03:50 PM, David Nadlinger wrote: On 4/14/11 3:44 PM, spir wrote: On 04/14/2011 02:40 PM, David Nadlinger wrote: On 4/14/11 2:26 PM, spir wrote: Not having any imports makes for a faster compile, too. ... and helps in having safe sandboxes. In which way exactly do I need

optionally verbose assertions

2011-04-14 Thread spir
On 04/14/2011 04:03 PM, Steven Schveighoffer wrote: Sometimes, I worry that my unit tests or asserts aren't running. Every once in a while, I have to change one to fail to make sure that code is compiling (this is especially true when I'm doing version statements or templates). It would be

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 04:22 PM, Andrei Alexandrescu wrote: On 4/14/11 6:52 AM, spir wrote: On 04/14/2011 01:11 AM, bearophile wrote: * Since most of them don't actually output anything, the program now detects output.length == 0 and says Program run successfully. upon completion to give some

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 04:24 PM, Andrei Alexandrescu wrote: On 4/14/11 7:25 AM, spir wrote: On 04/14/2011 03:04 AM, Adam D. Ruppe wrote: bearophile wrote: This is a problem. Unittest code is not meant to produce an output, while online snippets to try are meant to nearly always produce a meaningful

Re: single-line string?

2011-04-14 Thread spir
On 04/14/2011 05:03 PM, Andrej Mitrovic wrote: Some editors automatically add the closing double quote, which pretty much eliminates this problem. For example: step1: string s = |- caret step2: string s = |- caret step3: string s = |- editor automatically adds the ending quote step4: string s =

Re: optionally verbose assertions

2011-04-14 Thread spir
On 04/14/2011 05:47 PM, Steven Schveighoffer wrote: On Thu, 14 Apr 2011 11:28:39 -0400, spir denis.s...@gmail.com wrote: On 04/14/2011 04:03 PM, Steven Schveighoffer wrote: Sometimes, I worry that my unit tests or asserts aren't running. Every once in a while, I have to change one to fail

Re: optionally verbose assertions

2011-04-14 Thread spir
On 04/14/2011 06:35 PM, Daniel Gibson wrote: Am 14.04.2011 17:47, schrieb Steven Schveighoffer: On Thu, 14 Apr 2011 11:28:39 -0400, spirdenis.s...@gmail.com wrote: On 04/14/2011 04:03 PM, Steven Schveighoffer wrote: Sometimes, I worry that my unit tests or asserts aren't running. Every once

Re: optionally verbose assertions

2011-04-14 Thread spir
On 04/14/2011 06:52 PM, Steven Schveighoffer wrote: A compromise might be to be able to name unit tests, and then run a specific unit test by name on execution only. This allows you to ensure a specific unit test (and specific asserts in that unit test) are running without having to see all the

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 07:09 PM, Andrei Alexandrescu wrote: Applying let me output something and eye it at the level of each unit test does not scale because it makes it extremely difficult to identify issues once one test of many produces unexpected output. There are programs (such as expect) that

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-14 Thread spir
On 04/14/2011 07:58 PM, Jérôme M. Berger wrote: spir wrote: Actually, I have never been pleased that func defs (1) look like func calls (2) have an exceptional syntax compared to other definitions. I'd like instead eg: square = function (int n) int { return n * n

Re: Ceylon language

2011-04-14 Thread spir
On 04/14/2011 09:06 PM, bearophile wrote: But I guess optionality could, and should, extend to non-ref types; thus, null is just a particular case of non-existence. And this would apply especially on function parameters: void f (int i?) {...} From C# experience it seems non-ref

Re: Try it now

2011-04-14 Thread spir
On 04/14/2011 09:10 PM, Steven Schveighoffer wrote: On Thu, 14 Apr 2011 14:57:44 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On 4/14/11 1:26 PM, Steven Schveighoffer wrote: On Thu, 14 Apr 2011 13:54:00 -0400, Andrei Alexandrescu seewebsiteforem...@erdani.org wrote: On

Re: Else clauses for loops

2011-04-14 Thread spir
On 04/13/2011 06:48 PM, bearophile wrote: Bernard Helyer: You could wrap the loop in an if clause: if (condition) while (true) { // ... } else { // ... } This is the semantics of the else clause of Python for (and while) loops: bool broken = false; for

Re: So why doesn't popFront return an element?

2011-04-14 Thread spir
On 04/14/2011 01:00 AM, Andrej Mitrovic wrote: I'm trying to understand the design of ranges. Why does popFront only set the front() property to return the next element in the range? Why not return the element in the call to popFront right away? For example code like this (which doesn't work

un-requested compiler optimisations

2011-04-14 Thread spir
On 04/14/2011 06:57 PM, Andrej Mitrovic wrote: This leads me to another question I've always wanted to ask. A call such as: auto b=map!foo(map!bar1(map!bar2(a)); This constructs a lazy range. What I'm wondering is if there are any performance issues when constructing long chains of ranges like

Re: un-requested compiler optimisations

2011-04-14 Thread spir
On 04/14/2011 08:33 PM, Steven Schveighoffer wrote: If it does optimise, then it is definitely a compiler bug. Since you *explicitely* ask for a double reverse, it *must* just do it. Suppressing them is here just breaking the language's semantics! I feel like people aren't looking at my post

Re: D Tools Special Interest Group (SIG)

2011-04-13 Thread spir
On 04/13/2011 12:04 AM, Sean Kelly wrote: On Apr 1, 2011, at 11:53 AM, Bruno Medeiros wrote: On 22/03/2011 23:41, Jonas Drewsen wrote: Hi, It seems that every now and then a discussion about build tools or D package management pops up in this group. Many people on this list have a huge

Re: Temporarily disable all purity for debug prints

2011-04-12 Thread spir
On 04/12/2011 04:05 AM, Nick Sabalausky wrote: As more and more D2 functions become pure in my code and in Phobos, something like a -disablepure compiler switch (and printf/writeln inside debug{}) may allow more handy debugging with prints (if the purity is well managed by the compiler

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 01:47 AM, Nick Sabalausky wrote: Jonas Drewsenjdrew...@nospam.com wrote in message news:invnrn$2pgf$1...@digitalmars.com... On 11/04/11 22.01, Steven Schveighoffer wrote: On Mon, 11 Apr 2011 13:05:24 -0400, Russel Winderrus...@russel.org.uk wrote: On Mon, 2011-04-11 at 15:39

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 09:05 AM, Andrew Wiley wrote: On Tue, Apr 12, 2011 at 1:52 AM, Russel Winderrus...@russel.org.uk wrote: On Mon, 2011-04-11 at 19:47 -0400, Nick Sabalausky wrote: [ . . . ] Regardless, I think we've clearly demonstrated the complete impenetrability of (L)GPL. I've long since

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-12 Thread spir
On 04/12/2011 05:15 AM, Jonathan M Davis wrote: So, how you format your code matters. Using tabs screws with that unless you're completely consistent, and while a single developer may be consistent, groups of developers rarely are. This is as true in the case of spaces. With the additional

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-12 Thread spir
On 04/12/2011 05:19 AM, Jonathan M Davis wrote: Using only spaces and no tabs avoids the entire issue spaces -- tabs works as fine Why are programmers so blindly unfair when discussing this point? and is one of the major reasons (if not _the_ major reason) why it is incredibly common for

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-12 Thread spir
On 04/12/2011 07:13 AM, Jonathan M Davis wrote: It's true that people occasionally end up inserting tabs in space-only environments, but in my experience, it's fairly rare. It's pretty much a guarantee, however, that _someone_ will insert spaces in an environment where it's supposed to be tabs.

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-12 Thread spir
On 04/12/2011 09:24 AM, Jacob Carlborg wrote: Well, IMO, using spaces for indentation serves no useful purpose. At least tabs actually *mean* alignment and indentation. Spaces don't and never have. Plus, what's the use of being able place the cursor at arbtrary points within the 4 spaces (or 8

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 04:06 AM, Daniel Gibson wrote: Well I'd always use PostgreSQL instead of MySQL when having the choice, but 1. often MySQL needs to be used because it's already there 2. PostgreSQL uses the BSD-License which also isn't suitable for Phobos. BTW: I think PHP has a native SQL driver

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 04:18 AM, dsimcha wrote: On 4/11/2011 9:55 PM, Daniel Gibson wrote: Doesn't mysql even have some retarded restriction like it's GPL but may not be used for commercial purposes so buy mysql if you wanna use it to make money? According to Wikipedia

Re: LLVM Coding Standards

2011-04-12 Thread spir
On 04/11/2011 09:58 PM, spir wrote: I'm reading (just for interest) the LLVM Coding Standards at http://llvm.org/docs/CodingStandards.html. Find them very interesting because their purposes are clearly explained. Below sample. I also love their note about naming

Re: [GSOC] Database API draft proposal

2011-04-12 Thread spir
On 04/12/2011 04:15 AM, dsimcha wrote: I think 110% that SQLite should be the top priority w.r.t. database stuff. SQLite bindings and a good D API with some dependency inversion so the high-level API can be reused with other database backends would be a great GSoC project, even if nothing

Re: LLVM Coding Standards

2011-04-12 Thread spir
On 04/12/2011 12:31 AM, Spacen Jasset wrote: I think that people like to follow rules, that is as soon as they have internalised them and made them their own. What this means is that they often then follow them to a fault, and you get deeply nested, but structured code, where instead you would

Re: LLVM Coding Standards

2011-04-12 Thread spir
On 04/12/2011 02:34 AM, Nick Sabalausky wrote: The last few years though, I've been finding that I *never* have any trouble grokking code due to early exits or continue (unless the code is already convoluted anyway). And I've also realized I find code that makes intelligent use of it to be much

Re: LLVM Coding Standards

2011-04-12 Thread spir
On 04/12/2011 03:15 AM, Daniel Gibson wrote: While I am on the subject, I've *always* thought major languages have poor loop constructs: (A) for (;;) { std::getline(is, line); if (line.size() == 0) break; ...some things... } (...) Instead you

Re: Anyone interested in simpleaudio.d too?

2011-04-12 Thread spir
On 04/12/2011 06:30 AM, Adam D. Ruppe wrote: I just dug up my old wav.d and quickly added wav.play() support to it for both Windows and Linux. Now, this is sucky D1 code, but hey, it works, and it's short. If there's interest, I can port to D2 and add some range support to it and see about

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 12:24 PM, Nick Sabalausky wrote: Russel Winderrus...@russel.org.uk wrote in message news:mailman.3416.1302591172.4748.digitalmar...@puremagic.com... Personally I find licences such as BSD, MIT, ASL, etc. ones to avoid since they allow organizations to take software, sell it for

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 01:31 PM, Nick Sabalausky wrote: And most of all, I really think the chances of getting irreprably screwed over like that by putting a program out as BSD instead of GPL are small enough to just not be worth worrying about. Isn't BSD license also unwelcome into Phobos? (/That/

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 10:43 AM, Jacob Carlborg wrote: On 2011-04-12 03:45, Daniel Gibson wrote: Am 11.04.2011 19:05, schrieb Russel Winder: On Mon, 2011-04-11 at 15:39 +, Adam D. Ruppe wrote: [ . . . ] fine, but a standard library is distributed with D programs. LGPL requires you to send source

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 12:45 PM, Nick Sabalausky wrote: (depending, of course, on the incomprehensible details of the GPL) GPL is just one sample. And I don't get your insistance on incomprehensible details: as if you did not know *all* devices and all commercial software you have ever bought come

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 11:55 AM, Daniel Gibson wrote: Am 12.04.2011 11:34, schrieb spir: On 04/12/2011 04:06 AM, Daniel Gibson wrote: Well I'd always use PostgreSQL instead of MySQL when having the choice, but 1. often MySQL needs to be used because it's already there 2. PostgreSQL uses the BSD-License

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 03:02 PM, Daniel Gibson wrote: D is not a Linux/FOSS-only language, but also to be used on Windows and for proprietary software. And especially for Windows it's common to distribute software (especially freeware and shareware ) just as the self-contained binary. Windows apps have

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 04:01 PM, Fawzi Mohamed wrote: For my personal libs/programs I fully agree with spir: 1) attribution is a very light burden 2) it is nice, and somehow the right thing to do 3) it gives back at least a bit of advertisement to the stuff *you can use freely* For those reasons I did

Re: [OT] open-source license issues

2011-04-12 Thread spir
On 04/12/2011 08:19 PM, Jérôme M. Berger wrote: spir wrote: On 04/12/2011 04:18 AM, dsimcha wrote: On 4/11/2011 9:55 PM, Daniel Gibson wrote: Doesn't mysql even have some retarded restriction like it's GPL but may not be used for commercial purposes so buy mysql if you wanna use it to make

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-12 Thread spir
On 04/12/2011 10:08 PM, Nick Sabalausky wrote: Jérôme M. Bergerjeber...@free.fr wrote in message news:io2396$1nuo$1...@digitalmars.com... spir wrote: A drawback is one cannot directly have different indent levels, for instance to indent collection contents more, or less, than blocks of code

Re: Temporarily disable all purity for debug prints

2011-04-12 Thread spir
On 04/12/2011 09:54 PM, Steven Schveighoffer wrote: On Tue, 12 Apr 2011 15:48:33 -0400, bearophile bearophileh...@lycos.com wrote: Walter: pure void foo() { debug writeln(in foo()); } Simple and effective. Very simple designs are sometimes the mark of the genius. But isn't your idea able

Re: Range violation error in the code

2011-04-12 Thread spir
On 04/12/2011 02:20 PM, Ishan Thilina wrote: I can compile the following code. But when I run the program it gives me a core.exception.RangeError@untitled(34): Range violation error. The code is as follows. import std.stdio; int main(char[][] args) { struct Node{

strange warning at link-time

2011-04-12 Thread spir
/usr/bin/ld: Warning: size of symbol `_D5table14__T5TableTkTkZ5Table7opApplyMFDFKkZiZi' changed from 96 in /tmp/.rdmd/rdmd-table.d-403917940996C846133B5FCD56447466/table.o to 100 in /tmp/.rdmd/rdmd-table.d-403917940996C846133B5FCD56447466/table.o ??? Note: this is just a warning, program

Re: Semicolon can be left out after do-while

2011-04-12 Thread spir
On 04/12/2011 09:21 PM, Steven Schveighoffer wrote: int main(){ int a,b; do{ scanf(%d %d,a,b); }while(ab) //note missing semicolon here return 0; } The grammar specifies this correctly, but then again, the example uses the semicolon.

Re: Semicolon can be left out after do-while

2011-04-12 Thread spir
On 04/12/2011 11:51 PM, Steven Schveighoffer wrote: On Tue, 12 Apr 2011 17:21:57 -0400, spir denis.s...@gmail.com wrote: On 04/12/2011 09:21 PM, Steven Schveighoffer wrote: int main(){ int a,b; do{ scanf(%d %d,a,b); }while(ab) //note missing semicolon here return 0; } The grammar specifies

Re: http://lang-index.sourceforge.net/

2011-04-11 Thread spir
On 04/11/2011 08:05 AM, bearophile wrote: Andrej Mitrovic: I was browsing through that D filter on google, and found this: http://theinf2.informatik.uni-jena.de/For+Students/Lectures/D+Programming.html This must be the second school to teach D that I know of, after I've heard about

Re: simple display (from: GUI library for D)

2011-04-11 Thread spir
On 04/11/2011 03:54 AM, Adam D. Ruppe wrote: 1. *Please use spaces instead of tabs.* Spaces are the spawn of Satan! I hate them, but when it comes time to submit to phobos, I'll run a find/replace of them so it's consistent with the prevailing style there. Until then though, I'll write it in my

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-11 Thread spir
On 04/11/2011 07:51 AM, Jonathan M Davis wrote: the only way that tabs work is if you use them consistently, which in my experience almost never happens. And How so? If you probably set your editor, inconsistency simply cannot happen... The same is true for using spaces, anyway. Denis --

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-11 Thread spir
On 04/11/2011 08:13 AM, Jonathan M Davis wrote: They mix tabs and spaces. On some lines, they use spaces and on others they use tabs. Never seen this, not even once. Messing can only happen when one copy-pastes from modules using spaces. Denis -- _ vita es estrany

Re: std.algorithm for images

2011-04-11 Thread spir
On 04/11/2011 02:10 AM, Adam D. Ruppe wrote: I'm pretty happy with how simpledisplay.d is turning out, and want to spend some time thinking about the client side images now. I think a nice way to do it would be to go with ranges and templates, like std.algorithm, so things will work across many

[OT] open-source license issues

2011-04-11 Thread spir
On 04/11/2011 02:45 AM, Adam D. Ruppe wrote: Cliff Hudson wrote: Have you considered wrapping something like DevIL? I actually didn't consider it; since I already have decent homegrown loaders for a few formats I figured that'd be good enough, for now at least. But, looking now, DevIL is

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-11 Thread spir
On 04/11/2011 10:01 AM, Jonathan M Davis wrote: Jonathan M Davis Wrote: Personally, I think that it's _horrible_ to use tabs Why would one fear tabs? They change depending on your editor settings. That's precisely what they are meant for... unlike space-indentation, tab-indentation

Re: std.algorithm for images

2011-04-11 Thread spir
On 04/11/2011 06:09 PM, Adam D. Ruppe wrote: Walter Bright wrote: I don't know much about graphics [...] The irony is neither do I! But, an algorithm is an algorithm so I'm hoping if it can work well for the few I know, we'll have an approach that can work for others too, all written

Re: [OT] Spaces/tabs (Was: simple display (from: GUI library for D))

2011-04-11 Thread spir
On 04/11/2011 05:31 PM, Adam D. Ruppe wrote: bearophile: It's a module theoretically meant for Phobos, and the Phobos coding standard are spaces. Yeah, that's all that matters in the end. When in Rome... But it's trivial to do a find and replace all before submitting so really, it's just not

Re: YesOrNo: useful idiom helper or wanking?

2011-04-11 Thread spir
On 04/11/2011 04:59 PM, Andrej Mitrovic wrote: It looks like an awkward workaround for that feature called named arguments. True, but only for the case of yes/no; in this case only, the bool type provides proper *constants* which *meaning* is obvious. Else, you need an enum anyway, even

Re: YesOrNo: useful idiom helper or wanking?

2011-04-11 Thread spir
On 04/11/2011 07:49 PM, Andrej Mitrovic wrote: Also, I would rather name this template choice. YesOrNo is far better, by making it clear it's a kind of logical choice / closed question. Choice is super vague. Denis -- _ vita es estrany spir.wikidot.com

Re: YesOrNo: useful idiom helper or wanking?

2011-04-11 Thread spir
On 04/11/2011 08:16 PM, KennyTM~ wrote: import std.stdio; template YesOrNo(T) if(is(T == enum) !T.no T.yes) { alias T YesOrNo; } enum Redraw : bool { no, yes } void drawCircle(YesOrNo!Redraw redraw) { writeln(cast(bool) redraw); } void main() { drawCircle(Redraw.yes);

Re: YesOrNo: useful idiom helper or wanking?

2011-04-11 Thread spir
On 04/11/2011 08:16 PM, KennyTM~ wrote: If the goal of YesOrNo is simply for documentation, why not define it like this? import std.stdio; template YesOrNo(T) if(is(T == enum) !T.no T.yes) { alias T YesOrNo; } enum Redraw : bool { no, yes } void drawCircle(YesOrNo!Redraw redraw) {

Re: YesOrNo: useful idiom helper or wanking?

2011-04-11 Thread spir
On 04/11/2011 09:35 PM, Nick Sabalausky wrote: Andrei Alexandrescuseewebsiteforem...@erdani.org wrote in message news:inv4rv$1dfl$1...@digitalmars.com... A fair amount of code in std uses this idiom: enum SomeOption { no, yes } void someFunction(...parms..., SomeOption, ...more_parms...) {

  1   2   3   4   5   6   7   8   9   10   >