Re: Can I remove an element from a global associative array from within a class destructor?

2019-08-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 2, 2019 5:13:10 PM MDT realhet via Digitalmars-d-learn wrote: > Hi, > > I tried to make some resource statistict for my OpenGL Buffer > objects: > > > //here are the things that hold the statistics. > private __gshared{ size_t[int] textureSizeMap, bufferSizeMap; } > > struct

Re: [OT] Re: Using Haskell for teaching [was: Help me decide D or C]

2019-08-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 2, 2019 11:05:13 AM MDT Russel Winder via Digitalmars-d- learn wrote: > On Fri, 2019-08-02 at 10:25 -0600, Jonathan M Davis via > Digitalmars-d-learn wrote: > > […] > > > My feeling is that functional languages are likely to be a very poor > > place for most folks to start

Can I remove an element from a global associative array from within a class destructor?

2019-08-02 Thread realhet via Digitalmars-d-learn
Hi, I tried to make some resource statistict for my OpenGL Buffer objects: //here are the things that hold the statistics. private __gshared{ size_t[int] textureSizeMap, bufferSizeMap; } struct GLCounters{ int programs, shaders, textures, buffers; size_t textureSize, bufferSize; }

Re: Function called twice

2019-08-02 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote: Hello, I don't quite understand why isEven is called twice in the 2nd example? auto isEven(int n) { n.writeln; return (n % 2) == 0; } void main() { auto z = [1,2,3]; // outputs 1 2 3

Re: Function called twice

2019-08-02 Thread Boris Carvajal via Digitalmars-d-learn
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote: Hello, I don't quite understand why isEven is called twice in the 2nd example? auto isEven(int n) { n.writeln; return (n % 2) == 0; } void main() { auto z = [1,2,3]; // outputs 1 2 3

Re: Function called twice

2019-08-02 Thread Jordan Wilson via Digitalmars-d-learn
On Friday, 2 August 2019 at 22:35:53 UTC, Adam D. Ruppe wrote: On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote: // outputs 1 2 2 3 z.map!(a => tuple!("number","iseven")(a, a.isEven)) .filter!(a => a.iseven) .array; I *think* what's happening

Re: Function called twice

2019-08-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 2 August 2019 at 21:44:28 UTC, Jordan Wilson wrote: // outputs 1 2 2 3 z.map!(a => tuple!("number","iseven")(a, a.isEven)) .filter!(a => a.iseven) .array; I *think* what's happening here is first it calls map() first going into the filter... then

Function called twice

2019-08-02 Thread Jordan Wilson via Digitalmars-d-learn
Hello, I don't quite understand why isEven is called twice in the 2nd example? auto isEven(int n) { n.writeln; return (n % 2) == 0; } void main() { auto z = [1,2,3]; // outputs 1 2 3 z.map!(a => tuple!("number")(a)) .filter!(a =>

Re: How do I use mixin types?

2019-08-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 2 August 2019 at 21:10:08 UTC, Andrej wrote: The D spec mentions something called mixin types: This is brand new to the spec and hasn't yet been released in a compiler. You can get a nightly build here https://dlang.org/changelog/pending.html to maybe try, but I don't think it

How do I use mixin types?

2019-08-02 Thread Andrej via Digitalmars-d-learn
The D spec mentions something called mixin types: https://dlang.org/spec/grammar.html#MixinType https://dlang.org/spec/type.html#mixin_types If I'm understanding the grammar right, it means you can use a string mixin anywhere a Type would normally go, for example: int func(mixin("int") x) {

Re: Help me decide D or C

2019-08-02 Thread Jon Degenhardt via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Should I go for C and then when I become a better programmer change to D? Should I start with D right now? In my view, the most important thing is the decision you've already made - to pick a programming language and learn it in a

1 new

2019-08-02 Thread jmh530 via Digitalmars-d-learn
When I navigate to https://forum.dlang.org/ I have a message that says "1 new reply" to "your posts." Normally, I click on that "1 new reply" and find the post that's new, go to it, and the message disappears. However, it doesn't seem to go away anymore. I tried looking at many different old

Re: Help me decide D or C

2019-08-02 Thread berni via Digitalmars-d-learn
On Friday, 2 August 2019 at 14:05:20 UTC, SashaGreat wrote: On Friday, 2 August 2019 at 12:28:45 UTC, berni wrote: On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Should I go for C and then when I become a better programmer change to D? Should I start with D right now? In my

[OT] Re: Using Haskell for teaching [was: Help me decide D or C]

2019-08-02 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-08-02 at 10:25 -0600, Jonathan M Davis via Digitalmars-d-learn wrote: > […] > My feeling is that functional languages are likely to be a very poor place > for most folks to start learning, much as I think that they're great for > someone to learn and work with at some point. I have

Re: Help me decide D or C

2019-08-02 Thread Alexandre via Digitalmars-d-learn
On Friday, 2 August 2019 at 15:51:25 UTC, Russel Winder wrote: On Fri, 2019-08-02 at 13:45 +, Alexandre via Digitalmars-d-learn wrote: […] Could you elaborate more about C being a burden? I have read so many people saying C gives a great foundation and should be everyone's first

Re: Why does choose not work here

2019-08-02 Thread berni via Digitalmars-d-learn
On Thursday, 1 August 2019 at 21:26:10 UTC, Matt wrote: Anyone have any other thoughts? I tried to simplify your example a little bit: import std.stdio; import std.range; import std.algorithm; auto myFilter(R1, R2)(R1 a, R2 b) { return a.filter!(c => c==b.front); } struct A { int[]

Re: Help me decide D or C

2019-08-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, August 2, 2019 10:13:04 AM MDT bachmeier via Digitalmars-d-learn wrote: > On Thursday, 1 August 2019 at 22:36:06 UTC, Russel Winder wrote: > > On Thu, 2019-08-01 at 14:49 +, bachmeier via > > Digitalmars-d-learn wrote: […] > > > >> There's nothing wrong with Haskell if you want to

Re: Help me decide D or C

2019-08-02 Thread bachmeier via Digitalmars-d-learn
On Thursday, 1 August 2019 at 22:36:06 UTC, Russel Winder wrote: On Thu, 2019-08-01 at 14:49 +, bachmeier via Digitalmars-d-learn wrote: […] There's nothing wrong with Haskell if you want to take a deep dive into pure functional programming. I personally find Haskell to be more of a

Re: Help me decide D or C

2019-08-02 Thread bachmeier via Digitalmars-d-learn
On Friday, 2 August 2019 at 13:57:44 UTC, Bastiaan Veelo wrote: On Thursday, 1 August 2019 at 20:02:08 UTC, Aurélien Plazzotta wrote: [...] But don't fool yourself, D is not for beginners. Ali Çehreli is a very skilled programmer, ergo, he can't reason like a new/starting programmer anymore,

Re: Help me decide D or C

2019-08-02 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-08-02 at 13:45 +, Alexandre via Digitalmars-d-learn wrote: > […] > Could you elaborate more about C being a burden? I have read so > many people saying C gives a great foundation and should be > everyone's first language. Now I am confused. C is a programming language created

Re: Help me decide D or C

2019-08-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Friday, 2 August 2019 at 13:45:17 UTC, Alexandre wrote: On Friday, 2 August 2019 at 12:30:44 UTC, berni wrote: On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: [...] In my oppinion C should have been deprecated about 50 years ago and it's not worth while to learn it if you

Re: Help me decide D or C

2019-08-02 Thread SashaGreat via Digitalmars-d-learn
On Friday, 2 August 2019 at 12:28:45 UTC, berni wrote: On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Should I go for C and then when I become a better programmer change to D? Should I start with D right now? In my oppinion C should have been deprecated about 50 years ago ...

Re: Help me decide D or C

2019-08-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 1 August 2019 at 20:02:08 UTC, Aurélien Plazzotta wrote: [...] But don't fool yourself, D is not for beginners. Ali Çehreli is a very skilled programmer, ergo, he can't reason like a new/starting programmer anymore, regardless of his patience and kindness. I am sorry, but this

Re: Help me decide D or C

2019-08-02 Thread Alexandre via Digitalmars-d-learn
On Friday, 2 August 2019 at 12:30:44 UTC, berni wrote: On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: [...] In my oppinion C should have been deprecated about 50 years ago and it's not worth while to learn it if you are not interested in the history of programming or you have

Re: Help me decide D or C

2019-08-02 Thread Daniel Kozak via Digitalmars-d-learn
On Fri, Aug 2, 2019 at 2:30 PM berni via Digitalmars-d-learn wrote: > ... > I would even go further and state, that learning C first will > become a burden instead of a help. > Yes, I agree with this. It is same as with C++. Many people starts with C and then learn C++. Which is really not a

Re: Help me decide D or C

2019-08-02 Thread berni via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Should I go for C and then when I become a better programmer change to D? Should I start with D right now? In my oppinion C should have been deprecated about 50 years ago and it's not worth while to learn it if you are not

Re: Help me decide D or C

2019-08-02 Thread berni via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Should I go for C and then when I become a better programmer change to D? Should I start with D right now? In my oppinion C should have been deprecated about 50 years ago and it's not worth while to learn it if you are not

Re: Help me decide D or C

2019-08-02 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Should I go for C and then when I become a better programmer change to D? Should I start with D right now? D and C++ (and probably other languages) inherit features of C such as operator precendence, integer promotion, and a few

Re: Help me decide D or C

2019-08-02 Thread IGotD- via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 18:38:02 UTC, Alexandre wrote: Hi everyone, I would like an honest opinion. I have a beginner level (able to do very small programs) in a few languages such as python, go, C, guile(scheme) and common lisp. I want to pick a language and go deep with it and focus

Blog Post #0058: Cairo Rectangles

2019-08-02 Thread Ron Tarrant via Digitalmars-d-learn
Continuing on with Cairo, this is a look at the variations and permutations of drawing rectangles and you'll find it here: https://gtkdcoding.com/2019/08/02/0058-cairo-ii-rectangles.html

Re: Help me decide D or C

2019-08-02 Thread Tony via Digitalmars-d-learn
On Wednesday, 31 July 2019 at 22:30:52 UTC, Alexandre wrote: My goals: 1) Improve as a programmer 2) Have fun doing programs That's it basically. I am planning to study all "free" time I have. I am doing basically this since last year. Are you only considering D and C or just mentioning