Re: Looking for an equivalent to C++ std::getline in D

2017-05-10 Thread Ali Çehreli via Digitalmars-d-learn
On 05/09/2017 01:17 AM, k-five wrote: > On Monday, 8 May 2017 at 21:37:17 UTC, Ali Çehreli wrote: >> On 05/06/2017 02:24 AM, Stanislav Blinov wrote: >> > > It may D has this philosophy as Perl has: There's more than one way to > do it D certainly

Re: Processing a gzipped csv-file by line-by-line

2017-05-10 Thread Seb via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 23:19:15 UTC, H. S. Teoh wrote: Also, if you need to parse lots of CSV data very fast, you might be interested in this: https://github.com/quickfur/fastcsv T Or asdf: https://github.com/tamediadigital/asdf

Re: Processing a gzipped csv-file by line-by-line

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote: What's fastest way to on-the-fly-decompress and process a gzipped csv-fil line by line? Is it possible to combine http://dlang.org/phobos/std_zlib.html with some stream variant of File(path).byLineFast ? You can't really parse a

Re: alloca without runtime?

2017-05-10 Thread 岩倉 澪 via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 20:25:45 UTC, aberba wrote: On Thursday, 4 May 2017 at 14:54:58 UTC, 岩倉 澪 wrote: On Thursday, 4 May 2017 at 12:50:02 UTC, Kagamin wrote: You can try ldc and llvm intrinsics http://llvm.org/docs/LangRef.html#alloca-instruction

Re: Processing a gzipped csv-file by line-by-line

2017-05-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote: What's fastest way to on-the-fly-decompress and process a gzipped csv-fil line by line? Is it possible to combine http://dlang.org/phobos/std_zlib.html with some stream variant of File(path).byLineFast ? I suggest you take a look

Re: Processing a gzipped csv-file by line-by-line

2017-05-10 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 10, 2017 at 11:17:44PM +, Nicholas Wilson via Digitalmars-d-learn wrote: > On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote: > > What's fastest way to on-the-fly-decompress and process a gzipped > > csv-fil line by line? > > > > Is it possible to combine > > > >

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 20:01:16 UTC, Adam D. Ruppe wrote: ... Thanks loads. Thanks to this my next commit is going to have quite a few improvements that clean up the engine code considerably. I appreciate the help.

Re: Access specifiers and visibility

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:29:40 UTC, Andrew Edwards wrote: On Wednesday, 10 May 2017 at 13:13:46 UTC, Jesse Phillips wrote: On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote: Attempting to update a git repo to current D, I encounter the following deprecation messages:

Processing a gzipped csv-file by line-by-line

2017-05-10 Thread Nordlöw via Digitalmars-d-learn
What's fastest way to on-the-fly-decompress and process a gzipped csv-fil line by line? Is it possible to combine http://dlang.org/phobos/std_zlib.html with some stream variant of File(path).byLineFast ?

Re: Processing a gzipped csv-file by line-by-line

2017-05-10 Thread ketmar via Digitalmars-d-learn
Nordlöw wrote: What's fastest way to on-the-fly-decompress and process a gzipped csv-fil line by line? Is it possible to combine http://dlang.org/phobos/std_zlib.html with some stream variant of File(path).byLineFast ? iv.vfs[0] can do that (transparently decompress gzip files, and

Re: Problems with Array Assignment?

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 17:47:57 UTC, Samwise wrote: The expected behavior for this is to just see "Different Text" and "Other Text", instead of having any time to see just "Text". However, it seems that the second update method is having the effect that the first call should, and then

Re: alloca without runtime?

2017-05-10 Thread aberba via Digitalmars-d-learn
On Thursday, 4 May 2017 at 14:54:58 UTC, 岩倉 澪 wrote: On Thursday, 4 May 2017 at 12:50:02 UTC, Kagamin wrote: You can try ldc and llvm intrinsics http://llvm.org/docs/LangRef.html#alloca-instruction http://llvm.org/docs/LangRef.html#llvm-stacksave-intrinsic Ah, yep! pragma(LDC_alloca) void*

Re: Looking for an equivalent to C++ std::getline in D

2017-05-10 Thread k-five via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 10:47:13 UTC, Ali Çehreli wrote: On 05/09/2017 01:17 AM, k-five wrote: > On Monday, 8 May 2017 at 21:37:17 UTC, Ali Çehreli wrote: >> On 05/06/2017 02:24 AM, Stanislav Blinov wrote: >> Plus, wrapping steps of the

How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread k-five via Digitalmars-d-learn
I have a line of code that uses "to" function in std.conv for a purpose like: int index = to!int( user_apply[ 4 ] ); // string to int When the user_apply[ 4 ] has value, there is no problem; but when it is empty: "" it throws an ConvException exception and I want to avoid this exception.

Re: Access specifiers and visibility

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote: Attempting to update a git repo to current D, I encounter the following deprecation messages: src/glwtf/signals.d-mixin-256(256,2): Deprecation: glwtf.input.BaseGLFWEventHandler._on_key_down is not visible from module

Re: Access specifiers and visibility

2017-05-10 Thread Andrew Edwards via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:13:46 UTC, Jesse Phillips wrote: On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote: Attempting to update a git repo to current D, I encounter the following deprecation messages: src/glwtf/signals.d-mixin-256(256,2): Deprecation:

Re: Looking for an equivalent to C++ std::getline in D

2017-05-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Tuesday, May 09, 2017 21:37:19 Moritz Maxeiner via Digitalmars-d-learn wrote: > On Tuesday, 9 May 2017 at 19:11:08 UTC, Jonathan M Davis wrote: > > LOL. I get the impression that it's often the tendancy of D > > folks is to get excited when D shows up as high in a list like > > Tiobe and to

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:27:17 UTC, k-five wrote: Thanks, but I know about what are you saying. The user_apply[4] has so many possibilities and I cannot use if-else That doesn't sound right. Either you've already handled all the possible cases and thus expect the to! to not throw (can

Re: What's a good wat to trunctate a time point

2017-05-10 Thread Biotronic via Digitalmars-d-learn
On Friday, 5 May 2017 at 09:14:21 UTC, Biotronic wrote: Here's an implementation that supports start of year, month, week, day, hour, minute and second. Works for DateTime and SysTime. Not heavily tested (all tests included): As the last sentence says, there were holes in the testing,

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote: I have a line of code that uses "to" function in std.conv for a purpose like: int index = to!int( user_apply[ 4 ] ); // string to int When the user_apply[ 4 ] has value, there is no problem; but when it is empty: "" it throws an

Re: Problems with Array Assignment?

2017-05-10 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:34:30 UTC, Samwise wrote: I'm really sure this is just a stupid mistake I made, but I can't for the life of me figure out what is going on. Basically I'm trying to assign a reference to an object to an array, and the objects exist (an explicit destructor is

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Nicholas Wilson via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote: I have a line of code that uses "to" function in std.conv for a purpose like: int index = to!int( user_apply[ 4 ] ); // string to int When the user_apply[ 4 ] has value, there is no problem; but when it is empty: "" it throws an

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread k-five via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:12:46 UTC, Ivan Kazmenko wrote: On Wednesday, 10 May 2017 at 12:40:41 UTC, k-five wrote: -- I assume that an empty string is a valid input then. The question is, what value do you want `index` to have when

Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
I'm really sure this is just a stupid mistake I made, but I can't for the life of me figure out what is going on. Basically I'm trying to assign a reference to an object to an array, and the objects exist (an explicit destructor is writing lines at the end of the program, when the objects are

Re: Problems with Array Assignment?

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
In your code, I see one big mistake: --- class TileRenderer { private Tile[] tiles; /*...*/ } class CTileRenderer : TileRenderer { private CTile[] tiles; /*...*/ } --- Those are two separate arrays! Stuff examined through TileRenderer will be looking at a different array than looking

Lookahead in unittest

2017-05-10 Thread Raiderium via Digitalmars-d-learn
Heyo, On 2.074.0, the following test fails with "Error: undefined identifier 'B' " unittest { class A { B b; } class B { } } I can't figure out if this is intended behaviour. It's making a template-heavy module difficult to test. Would appreciate any help. First post

Re: Lookahead in unittest

2017-05-10 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 16:09:06 UTC, Raiderium wrote: Heyo, On 2.074.0, the following test fails with "Error: undefined identifier 'B' " unittest { class A { B b; } class B { } } I can't figure out if this is intended behaviour. It's making a template-heavy module

Re: Lookahead in unittest

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 16:09:06 UTC, Raiderium wrote: I can't figure out if this is intended behaviour. It is. A unittest is a function, and in functions, all declarations must be defined before used (just like local variables). Sometimes, you can wrap it in a struct: unittest {

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread k-five via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 14:27:46 UTC, Stanislav Blinov wrote: On Wednesday, 10 May 2017 at 13:27:17 UTC, k-five wrote: Thanks, but I know about what are you saying. The user_apply[4] has so many possibilities and I cannot use if-else That doesn't sound right. Either you've already

Re: Override @property

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 16:40:09 UTC, Aldo wrote: class PictureBox : Control { @property public override void texture(Texture value) { writeln("override"); this.m_texture = value; } } Error: function f340.PictureBox.texture

Re: Lookahead in unittest

2017-05-10 Thread Raiderium via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 16:32:11 UTC, Adam D. Ruppe wrote: On Wednesday, 10 May 2017 at 16:09:06 UTC, Raiderium wrote: I can't figure out if this is intended behaviour. It is. A unittest is a function, and in functions, all declarations must be defined before used (just like local

Override @property

2017-05-10 Thread Aldo via Digitalmars-d-learn
Hello, can you tell me if this compilation error is normal ? class Texture { public this() { } } class Control { private Texture m_texture; @property { public Texture texture() {

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:43:54 UTC, Adam D. Ruppe wrote: In your code, I see one big mistake: --- class TileRenderer { private Tile[] tiles; /*...*/ } class CTileRenderer : TileRenderer { private CTile[] tiles; /*...*/ } --- Those are two separate arrays! Stuff examined through

Re: subtlety or bug?

2017-05-10 Thread Carl Sturtivant via Digitalmars-d-learn
Aha, https://dlang.org/spec/struct.html#struct-destructor says that An identity assignment overload is required for a struct if one or more of these conditions hold: * it has a destructor so this is the above condition coming into play.

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
I'm also having another problem with this program that is (sorta?) related. If you notice in my main (minus all the comments...), the code creates two tiles, then updates the renderer so that it renders those tiles. Then I create another tile in the same place as one of the first ones (not

subtlety or bug?

2017-05-10 Thread Carl Sturtivant via Digitalmars-d-learn
The following compiles and runs correctly. https://forum.dlang.org/post/tzwsohkcqrkqotbwn...@forum.dlang.org But if I add a destructor to the reference struct template as follows, it no longer compiles, and the complaints are not about the destructor. ``` ~this() { ptr = null;

Re: Structure of platform specific vs non platform specific code

2017-05-10 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-05-09 20:08, Igor wrote: In case you are interested in the reasoning for having platform code that imports game code Casey explains that in case where you structure all platform specific code in functions that other code should call you are making a needlessly big interface polluting

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Stanislav Blinov via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 15:35:24 UTC, k-five wrote: On Wednesday, 10 May 2017 at 14:27:46 UTC, Stanislav Blinov wrote: On Wednesday, 10 May 2017 at 13:27:17 UTC, k-five wrote: Thanks, but I know about what are you saying. The user_apply[4] has so many possibilities and I cannot use

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Andrei Alexandrescu via Digitalmars-d-learn
On 5/10/17 3:40 PM, k-five wrote: I have a line of code that uses "to" function in std.conv for a purpose like: int index = to!int( user_apply[ 4 ] ); // string to int When the user_apply[ 4 ] has value, there is no problem; but when it is empty: "" it throws an ConvException exception and

Re: Error writing file a *.obj

2017-05-10 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 14:08:48 UTC, bachmeier wrote: On Tuesday, 9 May 2017 at 02:33:06 UTC, dummy wrote: On Monday, 8 May 2017 at 12:29:27 UTC, bachmeier wrote: On Monday, 8 May 2017 at 11:56:10 UTC, dummy wrote: When i build some application with dub, i got this error: I'm not a Dub

Re: Error writing file a *.obj

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 02:33:06 UTC, dummy wrote: On Monday, 8 May 2017 at 12:29:27 UTC, bachmeier wrote: On Monday, 8 May 2017 at 11:56:10 UTC, dummy wrote: When i build some application with dub, i got this error: I'm not a Dub user, but it has its own forum, so you might want to try

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Moritz Maxeiner via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 21:19:21 UTC, Stanislav Blinov wrote: "nothrow" does not turn off exceptions, it simply forbids throwing them in the enclosing scope (i.e. calling anything that might throw is not allowed). nothrow disallows the function scope to throw exceptions not derived from

Re: How to avoid throwing an exceptions for a built-in function?

2017-05-10 Thread Ali Çehreli via Digitalmars-d-learn
On 05/10/2017 05:40 AM, k-five wrote: > I have a line of code that uses "to" function in std.conv for a purpose > like: > > int index = to!int( user_apply[ 4 ] ); // string to int > > When the user_apply[ 4 ] has value, there is no problem; but when it is > empty: "" > it throws an ConvException

Re: Problems with Array Assignment?

2017-05-10 Thread Samwise via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 17:54:38 UTC, Adam D. Ruppe wrote: On Wednesday, 10 May 2017 at 17:47:57 UTC, Samwise wrote: The expected behavior for this is to just see "Different Text" and "Other Text", instead of having any time to see just "Text". However, it seems that the second update

Re: Productive vibe.d dev environment (IDE, debugger) on Linux?

2017-05-10 Thread aberba via Digitalmars-d-learn
On Wednesday, 3 May 2017 at 17:43:07 UTC, kinke wrote: Hey guys, can anyone recommend a more or less production-ready dev environment for vibe.d on Linux? I'm evaluating vibe.d against Phoenix (Elixir/Erlang) for a new project. Today I gave Visual Studio Code a quick shot (with LDC 1.1.1 and

Re: Problems with Array Assignment?

2017-05-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 17:26:09 UTC, Samwise wrote: I wondered about that when I did it, but I assumed (wrongly) that since the name of the array was the same, it would override it. Nope, this is a somewhat common mistake coming from Python users, but it can't work that way in D since