Re: How will std.allocator change how we program in D?
On Friday, October 02, 2015 23:54:15 Taylor Hillegeist via Digitalmars-d-learn wrote: > I do not come from a c++ background. but have looked at what > allocators do for c++. I know in D the standard for memory > management is garbage collection and if we want to manage it > ourselfs we have to do things like @nogc. I was just curious how > the std allocator will change how we do things. That's very much an open question. It's too early to tell, I think. Another major factor is that Walter and Andrei are considering adding some kind of reference counting to the language (not ARC, I don't think, and it won't be required - just in addition to what we have now), and that would have a big impact on this sort of thing as well. I fully expect that exceptions will eventually be reference-counted, and it may become normal for them not to be GC-allocated as a result. But we'll have to wait and see. Another issue is std.container (or probably std.collections ultimately, since it's being redone, and we don't want to conflict with what's currently there), since that will end up using the allocators, and the impact of that could be far-reaching. For many programs, it'll probably be the only place that allocators get used though, simply because many folks are likely to just not worry that much about the GC and memory management until it actually becomes a problem for them. The folks that have stricter performance requirements will likely start using the allocators quite a bit though. Certainly, now that we have std.experimental.allocator, more code is going to be written which tries to avoid the GC, and as that's done, I expect that more idioms will come of it. The way that the allocators have been written is somewhat novel and unique, but I don't know how much that will affect their usage. In the long run though, I suspect that allocators will get used in D more than they're typically used in C++ - if nothing else because the GC is the default in D, and plenty of folks want to avoid the GC whether they actually need to or not, whereas C++'s default is manual memory management. - Jonathan M Davis
Re: AWS API Dlang, hmac sha256 function.
On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d Thank you for answer. I used dub to fetch botan, after that i created project: dub init projectname botan and tried to add botan module: $ cat app.d #!/usr/bin/rdmd import std.stdio; import botan.mac.hmac; void main() { writeln("Edit source/app.d to start your project."); } but when im trying to run my simple app i get: $ ./app.d ./app.d(4): Error: module hmac is in file 'botan/mac/hmac.d' which cannot be read import path[0] = . import path[1] = /usr/include/dlang/dmd Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] What am i doing wrong? How to add library with dub package manager? Im really beginner in D (basically in programming) sorry if im asking obvious questions. By the looks of that error message with paths, botan isn't actually added as a dependency. Can you please paste the dub file? O wait nevermind. Use dub to compile/run your program. You are using the shebang line! $ dub run According to my other question are that functions equivalent to that python one? If they are not doing exact that same i could not create auth string which is needed to connect to AWS api. I can't say for certain if it is not exact. The reason I did not answer it is because I am not familiar with environment or any of what you are doing. I can unfortunately only point you in the right direction. Thank you for explaining how to use dub. I find out in master branch of phobos on git hub is included hmac.d module which will be added in next release of phobos so i think that will be best solution for me to stick with standard library for beginning. https://github.com/D-Programming-Language/phobos/tree/master/std I downloaded hmac.d and new version of digest.d file and place them in my phobos library. I think it exactly contains what i need but when im trying to test it i have such error: $ ./app.d ./app.d(9): Error: template std.digest.hmac.hmac cannot deduce function from argument types !(SHA!(512, 256))(immutable(ubyte)[]), candidates are: /usr/include/dlang/dmd/std/digest/hmac.d(202): std.digest.hmac.hmac(H) if (isDigest!H && hasBlockSize!H) /usr/include/dlang/dmd/std/digest/hmac.d(208): std.digest.hmac.hmac(H, ulong blockSize)(scope const(ubyte)[] secret) if (isDigest!H) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] My test code (based on unint test from module) looks like that: #!/usr/bin/rdmd import std.stdio; import std.digest.sha, std.digest.hmac; import std.string : representation; void main() { auto hmac = hmac!SHA256("secretkey".representation); auto digest = hmac.put("texttohash".representation).finish; writeln(digest); } Am i using it correctly? By the looks of things the problem is with SHA256, I'm guessing it doesn't have its block size defined. https://github.com/D-Programming-Language/phobos/blob/master/std/digest/digest.d#L394 You'll also need to update sha.d as well. Otherwise it looks good.
Re: AWS API Dlang, hmac sha256 function.
On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: [...] By the looks of that error message with paths, botan isn't actually added as a dependency. Can you please paste the dub file? O wait nevermind. Use dub to compile/run your program. You are using the shebang line! $ dub run [...] I can't say for certain if it is not exact. The reason I did not answer it is because I am not familiar with environment or any of what you are doing. I can unfortunately only point you in the right direction. Thank you for explaining how to use dub. I find out in master branch of phobos on git hub is included hmac.d module which will be added in next release of phobos so i think that will be best solution for me to stick with standard library for beginning. https://github.com/D-Programming-Language/phobos/tree/master/std I downloaded hmac.d and new version of digest.d file and place them in my phobos library. I think it exactly contains what i need but when im trying to test it i have such error: $ ./app.d ./app.d(9): Error: template std.digest.hmac.hmac cannot deduce function from argument types !(SHA!(512, 256))(immutable(ubyte)[]), candidates are: /usr/include/dlang/dmd/std/digest/hmac.d(202): std.digest.hmac.hmac(H) if (isDigest!H && hasBlockSize!H) /usr/include/dlang/dmd/std/digest/hmac.d(208): std.digest.hmac.hmac(H, ulong blockSize)(scope const(ubyte)[] secret) if (isDigest!H) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] My test code (based on unint test from module) looks like that: #!/usr/bin/rdmd import std.stdio; import std.digest.sha, std.digest.hmac; import std.string : representation; void main() { auto hmac = hmac!SHA256("secretkey".representation); auto digest = hmac.put("texttohash".representation).finish; writeln(digest); } Am i using it correctly? By the looks of things the problem is with SHA256, I'm guessing it doesn't have its block size defined. https://github.com/D-Programming-Language/phobos/blob/master/std/digest/digest.d#L394 You'll also need to update sha.d as well. Otherwise it looks good. I updated sha.d and now im getting following error: $ ./app.d /usr/include/dlang/dmd/std/digest/sha.d(225): Error: pure function 'std.digest.sha.SHA!(512u, 160u).SHA.transform' cannot call impure function 'core.cpuid.ssse3' /usr/include/dlang/dmd/std/digest/digest.d(285): Error: template instance std.range.primitives.isOutputRange!(SHA!(512u, 160u), const(ubyte)[]) error instantiating /usr/include/dlang/dmd/std/digest/digest.d(851): instantiated from here: isDigest!(SHA!(512u, 160u)) /usr/include/dlang/dmd/std/digest/sha.d(1179):while looking for match for WrapperDigest!(SHA!(512u, 160u)) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] And one more file (ssse3.d) needs to be updated. You are going to be playing whack a mole I think for a while.
Re: AWS API Dlang, hmac sha256 function.
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Hello I'm trying to contact AWS API with D according to documentation: [...] check https://github.com/yannick/vibe-aws it has v4 implemented
Re: How will std.allocator change how we program in D?
On 03/10/15 12:54 PM, Taylor Hillegeist wrote: I do not come from a c++ background. but have looked at what allocators do for c++. I know in D the standard for memory management is garbage collection and if we want to manage it ourselfs we have to do things like @nogc. I was just curious how the std allocator will change how we do things. All of my code here uses it: https://github.com/rikkimax/alphaPhobos With any luck it will all be destined for Phobos. The biggest set of changes is visible with the image library and URI. https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/uri.d You care far more about not allocating because of it. Atleast that was my goal. Something I'm definitely recently started getting into is ref counting. https://github.com/rikkimax/alphaPhobos/blob/master/source/std/experimental/platform.d#L16 So both the memory can be exposed and deallocated when it is no longer used. But generally you won't care one bit about allocators. https://github.com/rikkimax/alphaPhobos/blob/master/source/app.d#L39 The only reason you need to care is if you want a very specific set of life time of all memory created in a api and know/care when it dies. Also if you got some clever way to allocate, too would matter. But this may be different for somebody else. It is just my limited experience.
Re: __simd_sto confusion
This is a bug in overload resolution when __vector(void[16]) is involved. You can go around it by changing float4 to void16, only to run into an internal compiler error: backend/gother.c 988 So file a bug for both @ issues.dlang.org Also it looks like DMD wants you to use the return value of the intrinsic, is that expected? -- Marco
Re: AWS API Dlang, hmac sha256 function.
On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: [...] By the looks of that error message with paths, botan isn't actually added as a dependency. Can you please paste the dub file? O wait nevermind. Use dub to compile/run your program. You are using the shebang line! $ dub run [...] I can't say for certain if it is not exact. The reason I did not answer it is because I am not familiar with environment or any of what you are doing. I can unfortunately only point you in the right direction. Thank you for explaining how to use dub. I find out in master branch of phobos on git hub is included hmac.d module which will be added in next release of phobos so i think that will be best solution for me to stick with standard library for beginning. https://github.com/D-Programming-Language/phobos/tree/master/std I downloaded hmac.d and new version of digest.d file and place them in my phobos library. I think it exactly contains what i need but when im trying to test it i have such error: $ ./app.d ./app.d(9): Error: template std.digest.hmac.hmac cannot deduce function from argument types !(SHA!(512, 256))(immutable(ubyte)[]), candidates are: /usr/include/dlang/dmd/std/digest/hmac.d(202): std.digest.hmac.hmac(H) if (isDigest!H && hasBlockSize!H) /usr/include/dlang/dmd/std/digest/hmac.d(208): std.digest.hmac.hmac(H, ulong blockSize)(scope const(ubyte)[] secret) if (isDigest!H) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] My test code (based on unint test from module) looks like that: #!/usr/bin/rdmd import std.stdio; import std.digest.sha, std.digest.hmac; import std.string : representation; void main() { auto hmac = hmac!SHA256("secretkey".representation); auto digest = hmac.put("texttohash".representation).finish; writeln(digest); } Am i using it correctly? By the looks of things the problem is with SHA256, I'm guessing it doesn't have its block size defined. https://github.com/D-Programming-Language/phobos/blob/master/std/digest/digest.d#L394 You'll also need to update sha.d as well. Otherwise it looks good. I updated sha.d and now im getting following error: $ ./app.d /usr/include/dlang/dmd/std/digest/sha.d(225): Error: pure function 'std.digest.sha.SHA!(512u, 160u).SHA.transform' cannot call impure function 'core.cpuid.ssse3' /usr/include/dlang/dmd/std/digest/digest.d(285): Error: template instance std.range.primitives.isOutputRange!(SHA!(512u, 160u), const(ubyte)[]) error instantiating /usr/include/dlang/dmd/std/digest/digest.d(851): instantiated from here: isDigest!(SHA!(512u, 160u)) /usr/include/dlang/dmd/std/digest/sha.d(1179):while looking for match for WrapperDigest!(SHA!(512u, 160u)) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."]
Re: How to use std.range.interfaces in pure @safe code
On Friday, October 02, 2015 19:45:05 Freddy via Digitalmars-d-learn wrote: > How do I use http://dlang.org/phobos/std_range_interfaces.html in > pure @safe code? You don't. None of the functions in those interfaces are marked with @safe or pure. One of the problems with classes is that you're stuck with whatever attributes a base class put on a function. If it has an attribute like @safe or pure, then the derived class can't do anything that requires that they be @system or pure, whereas if it doesn't have those attributes, then it can't be used in code that's @safe or pure. For @safe, @trusted can be used, but that only makes sense if the the code is legitimately @safe in spite of the @system stuff that it's doing (i.e. the programmer verified it), whereas if it depends on the caller or just plain isn't @safe, then you're stuck, and with pure, you're pretty much just stuck. nothrow has the same problems. In general, I would strongly advise against using any of the interfaces in std.range.interfaces and just use structs and templatize your code. Then you don't run into any of those problems, since pure, @safe, and nothrow get inferred as appropriate, and it's likely to be more efficient, since you don't end up with any virtual calls, and there are better optimization opportunities (such as inlining). But if you do really need to use interfaces like that, then you can just write your own and put whatever attributes you want on their functions. That won't work if you have to interact with someone else's code that's using those interfaces, but aside from that, it should work just fine. But if you _have_ to use those interfaces, then you simply can't use them in code that has to be @safe, pure, or nothrow. - Jonathan M Davis
Re: AWS API Dlang, hmac sha256 function.
On Saturday, 3 October 2015 at 12:50:58 UTC, Rikki Cattermole wrote: On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: [...] By the looks of things the problem is with SHA256, I'm guessing it doesn't have its block size defined. https://github.com/D-Programming-Language/phobos/blob/master/std/digest/digest.d#L394 You'll also need to update sha.d as well. Otherwise it looks good. I updated sha.d and now im getting following error: $ ./app.d /usr/include/dlang/dmd/std/digest/sha.d(225): Error: pure function 'std.digest.sha.SHA!(512u, 160u).SHA.transform' cannot call impure function 'core.cpuid.ssse3' /usr/include/dlang/dmd/std/digest/digest.d(285): Error: template instance std.range.primitives.isOutputRange!(SHA!(512u, 160u), const(ubyte)[]) error instantiating /usr/include/dlang/dmd/std/digest/digest.d(851): instantiated from here: isDigest!(SHA!(512u, 160u)) /usr/include/dlang/dmd/std/digest/sha.d(1179):while looking for match for WrapperDigest!(SHA!(512u, 160u)) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] And one more file (ssse3.d) needs to be updated. You are going to be playing whack a mole I think for a while. I downloaded whole master branch phobos and tried to use it (changed path in dmd.conf), but there are missing much more files (i think that master branch is not ready yet). So i get back to my original library and tried to updated file you mention. But i can't find it (ssse3.d), its not appearing in my stable lib and even in that master-branch from zip file.
Re: AWS API Dlang, hmac sha256 function.
On Saturday, 3 October 2015 at 05:02:58 UTC, Rikki Cattermole wrote: On 03/10/15 6:01 PM, Rikki Cattermole wrote: On 03/10/15 4:54 PM, holo wrote: On Saturday, 3 October 2015 at 03:15:21 UTC, Rikki Cattermole wrote: You could implement it yourself, (it looks pretty easy). Or go the route of Botan: https://github.com/etcimon/botan/blob/3bdc835d5b9bad7523deaa86fe98b1fbb2f09d6b/source/botan/mac/hmac.d Thank you for answer. I used dub to fetch botan, after that i created project: dub init projectname botan and tried to add botan module: $ cat app.d #!/usr/bin/rdmd import std.stdio; import botan.mac.hmac; void main() { writeln("Edit source/app.d to start your project."); } but when im trying to run my simple app i get: $ ./app.d ./app.d(4): Error: module hmac is in file 'botan/mac/hmac.d' which cannot be read import path[0] = . import path[1] = /usr/include/dlang/dmd Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] What am i doing wrong? How to add library with dub package manager? Im really beginner in D (basically in programming) sorry if im asking obvious questions. By the looks of that error message with paths, botan isn't actually added as a dependency. Can you please paste the dub file? O wait nevermind. Use dub to compile/run your program. You are using the shebang line! $ dub run According to my other question are that functions equivalent to that python one? If they are not doing exact that same i could not create auth string which is needed to connect to AWS api. I can't say for certain if it is not exact. The reason I did not answer it is because I am not familiar with environment or any of what you are doing. I can unfortunately only point you in the right direction. Thank you for explaining how to use dub. I find out in master branch of phobos on git hub is included hmac.d module which will be added in next release of phobos so i think that will be best solution for me to stick with standard library for beginning. https://github.com/D-Programming-Language/phobos/tree/master/std I downloaded hmac.d and new version of digest.d file and place them in my phobos library. I think it exactly contains what i need but when im trying to test it i have such error: $ ./app.d ./app.d(9): Error: template std.digest.hmac.hmac cannot deduce function from argument types !(SHA!(512, 256))(immutable(ubyte)[]), candidates are: /usr/include/dlang/dmd/std/digest/hmac.d(202): std.digest.hmac.hmac(H) if (isDigest!H && hasBlockSize!H) /usr/include/dlang/dmd/std/digest/hmac.d(208): std.digest.hmac.hmac(H, ulong blockSize)(scope const(ubyte)[] secret) if (isDigest!H) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] My test code (based on unint test from module) looks like that: #!/usr/bin/rdmd import std.stdio; import std.digest.sha, std.digest.hmac; import std.string : representation; void main() { auto hmac = hmac!SHA256("secretkey".representation); auto digest = hmac.put("texttohash".representation).finish; writeln(digest); } Am i using it correctly?
__simd_sto confusion
I'm trying to create some linear algebra functions using simd intrinsics. I watched the dconf 2013 presentation by Manu Evans but i'm still confused about some aspects and the following piece of code doesn't work. I'm trying to copy the result of a dot product from the register to memory but dmd fails with an overload resolution error, which i guess is due some implicit conversion? dmd error: simd1.d(34): Error: core.simd.__simd_sto called with argument types (XMM, float, __vector(float[4])) matches both: /usr/include/dlang/dmd/core/simd.d(434): core.simd.__simd_sto(XMM opcode, double op1, __vector(void[16]) op2) and: /usr/include/dlang/dmd/core/simd.d(435): core.simd.__simd_sto(XMM opcode, float op1, __vector(void[16]) op2) from the following piece of code: float dot_simd1(float4 a, float4 b) { float4 result = __simd(XMM.DPPS, a, b, 0xFF); float value; __simd_sto(XMM.STOSS, value, result); return value; } What am I doing wrong here?
Re: OT: interesting talk by Jane Street technical guy on why they used Ocaml
On Saturday, 3 October 2015 at 01:41:55 UTC, Laeeth Isharc wrote: https://www.youtube.com/watch?v=hKcOkWzj0_s a little old but still relevant. talks about importance of brevity and strong types for readability (also avoiding boilerplate). two of the partners there committed to read every line of code (originally because they were terrified). very hard to code review boilerplate carefully because it is just too dull! (can't pay people enough!) [...] there's also andy smith's talk [0] at dconf 2015 on adapting D, titled "hedge fund development case study." [0] https://www.youtube.com/watch?v=0KBhb0iWsWQ
Re: OT: interesting talk by Jane Street technical guy on why they used Ocaml
On Saturday, 3 October 2015 at 15:58:38 UTC, Mengu wrote: On Saturday, 3 October 2015 at 01:41:55 UTC, Laeeth Isharc wrote: https://www.youtube.com/watch?v=hKcOkWzj0_s a little old but still relevant. talks about importance of brevity and strong types for readability (also avoiding boilerplate). two of the partners there committed to read every line of code (originally because they were terrified). very hard to code review boilerplate carefully because it is just too dull! (can't pay people enough!) [...] there's also andy smith's talk [0] at dconf 2015 on adapting D, titled "hedge fund development case study." [0] https://www.youtube.com/watch?v=0KBhb0iWsWQ Thanks! Funnily enough I rewatched the Jane Street talk because of a suggestion made by John Colvin when I was talking to Andy and him recently. It's a good talk by Andy, and I hope to build on this with him at Codemesh next month. The way languages actually get adopted is different from how people who are sitting in eg the kind of enterprise environment where they are never going to be early adopters imagine. Hence one is much better off focusing efforts on those already receptive (and who are looking for a solution to their pain) than trying to convert those who are happy with what they have or uninterested (possibly rationally so) in exploring new things. Being able to understand the codebase is underrated I think.
Re: AWS API Dlang, hmac sha256 function.
On Saturday, 3 October 2015 at 03:11:06 UTC, holo wrote: Last but not least, how to write such function in D: def sign(key, msg): return hmac.new(key, msg.encode("utf-8"), hashlib.sha256).digest() ? I can't find in standard libraryt hmac function, is it existing? The next version of D will have a std.digest.hmac module: http://dlang.org/phobos-prerelease/std_digest_hmac.html
buffered output to files
In this great article [1] there is a brief section on buffered output to files. Also in this thread [2] I was advised to use explicitly buffered output for maximum performance. This left me perplexed: surely any high-level routines already use buffered IO, no? [1] http://nomad.so/2015/09/working-with-files-in-the-d-programming-language/ [2] http://forum.dlang.org/post/ydgmzhlspvvvrbeem...@forum.dlang.org In order to get a better understanding of the issue, I decided to do a bit of simple testing with kind with the kind of file writing I have to do very often: millions of shortish formatted data records. My simple test program is here: http://dpaste.dzfl.pl/329023e651c4. Time to write 10 million formatted records (average of 10 runs) using format ("%d %d %0.8f", i, i*13, i/1e7) with different methods: GDCDMD f0: 12.0s 15.2s std.stdio.writef f1: 10.0s 13.6s 1Mb buffer std.array.appender; std.stdio.rawWrite f2: 10.3s 13.6s 300Mb buffer std.outbuffer; std.file.write f3: 4.9s 5.0s std.stdc.fprintf f4: 4.8s 4.8s 30b buffer std.stdc.sprintf (no file output) * gdc (Debian 5.2.1-17) 5.2.1 20150911 :: -O3 -frelease -march=native * dmd DMD64 D Compiler v2.068.1 :: -O -release -inline Some observations: * the two double-buffered output approaches (f1 and f2) are roughly the same * the performance gain from the extra buffering was not huge (about 20%) * good old fprintf seems to be my best bet :-( These results may be very specific to my conditions, but I throw them out there just in case others may be interested.
Re: __simd_sto confusion
On Saturday, 3 October 2015 at 15:39:33 UTC, Marco Leise wrote: This is a bug in overload resolution when __vector(void[16]) is involved. You can go around it by changing float4 to void16, only to run into an internal compiler error: backend/gother.c 988 So file a bug for both @ issues.dlang.org Also it looks like DMD wants you to use the return value of the intrinsic, is that expected? I guessed I wouldn't need the return value as the intel C intrinsic for this opcode has a void return type. I did try supplying a return type but I couldn't circumvent the overload error so I had no clue if it would make any difference. I changed the type of result to void16 like this: float dot_simd1(float4 a, float4 b) { void16 result = __simd(XMM.DPPS, a, b, 0xFF); float value; __simd_sto(XMM.STOSS, value, result); return value; } and for me this code compiles and runs without any errors now. I'm using DMD64 D Compiler v2.068 on Linux. If you got an internal compiler error that means that it's a compiler bug though I have no clue what. Did you try the same thing I did or casting the variable? I guess I should file a bugreport for overload resolution if it's not a duplicate for now?
Re: OT: interesting talk by Jane Street technical guy on why they used Ocaml
On Saturday, 3 October 2015 at 16:33:38 UTC, Laeeth Isharc wrote: On Saturday, 3 October 2015 at 15:58:38 UTC, Mengu wrote: On Saturday, 3 October 2015 at 01:41:55 UTC, Laeeth Isharc wrote: https://www.youtube.com/watch?v=hKcOkWzj0_s a little old but still relevant. talks about importance of brevity and strong types for readability (also avoiding boilerplate). two of the partners there committed to read every line of code (originally because they were terrified). very hard to code review boilerplate carefully because it is just too dull! (can't pay people enough!) [...] there's also andy smith's talk [0] at dconf 2015 on adapting D, titled "hedge fund development case study." [0] https://www.youtube.com/watch?v=0KBhb0iWsWQ Thanks! Funnily enough I rewatched the Jane Street talk because of a suggestion made by John Colvin when I was talking to Andy and him recently. It's a good talk by Andy, and I hope to build on this with him at Codemesh next month. The way languages actually get adopted is different from how people who are sitting in eg the kind of enterprise environment where they are never going to be early adopters imagine. Hence one is much better off focusing efforts on those already receptive (and who are looking for a solution to their pain) than trying to convert those who are happy with what they have or uninterested (possibly rationally so) in exploring new things. Being able to understand the codebase is underrated I think. i watched this talk by yaron last year when i was looking at alternatives for sml. i was taking the programming languages course on coursera by dan grossman. ocaml looked like it tooked off at the beginning of 2000s but then due to many problems it failed to be a mainstream language. imho, D will never take off like go or rust because people who adopted these languages are mostly python and ruby developers. D has an incredibly creative and helpful community yet our community is not as enthusiastic as go's and rust's community. phobos is extremely a great library yet not very welcoming and feels overly complicated. we should reduce the amount of WTFs when reading the phobos source and docs.
Re: __simd_sto confusion
Am Sat, 03 Oct 2015 23:42:22 + schrieb Nachtraaf: > I changed the type of result to void16 like this: > > float dot_simd1(float4 a, float4 b) > { > void16 result = __simd(XMM.DPPS, a, b, 0xFF); > float value; > __simd_sto(XMM.STOSS, value, result); > return value; > } > > and for me this code compiles and runs without any errors now. > I'm using DMD64 D Compiler v2.068 on Linux. If you got an > internal compiler error that means that it's a compiler bug > though I have no clue what. Did you try the same thing I did or > casting the variable? > I guess I should file a bugreport for overload resolution if it's > not a duplicate for now? Yes. At some point the intrinsics will need a more thorough rework. Currently none of those that return void, int or set flags work as they should. -- Marco
Re: AWS API Dlang, hmac sha256 function.
On 04/10/15 2:31 AM, holo wrote: On Saturday, 3 October 2015 at 12:50:58 UTC, Rikki Cattermole wrote: On 04/10/15 1:49 AM, holo wrote: On Saturday, 3 October 2015 at 12:22:11 UTC, Rikki Cattermole wrote: On 04/10/15 1:09 AM, holo wrote: [...] By the looks of things the problem is with SHA256, I'm guessing it doesn't have its block size defined. https://github.com/D-Programming-Language/phobos/blob/master/std/digest/digest.d#L394 You'll also need to update sha.d as well. Otherwise it looks good. I updated sha.d and now im getting following error: $ ./app.d /usr/include/dlang/dmd/std/digest/sha.d(225): Error: pure function 'std.digest.sha.SHA!(512u, 160u).SHA.transform' cannot call impure function 'core.cpuid.ssse3' /usr/include/dlang/dmd/std/digest/digest.d(285): Error: template instance std.range.primitives.isOutputRange!(SHA!(512u, 160u), const(ubyte)[]) error instantiating /usr/include/dlang/dmd/std/digest/digest.d(851): instantiated from here: isDigest!(SHA!(512u, 160u)) /usr/include/dlang/dmd/std/digest/sha.d(1179):while looking for match for WrapperDigest!(SHA!(512u, 160u)) Failed: ["dmd", "-v", "-o-", "./app.d", "-I."] And one more file (ssse3.d) needs to be updated. You are going to be playing whack a mole I think for a while. I downloaded whole master branch phobos and tried to use it (changed path in dmd.conf), but there are missing much more files (i think that master branch is not ready yet). So i get back to my original library and tried to updated file you mention. But i can't find it (ssse3.d), its not appearing in my stable lib and even in that master-branch from zip file. Apologies, I didn't see this till after I got to bed. It's core.cpuid not ssse3.d. It will be in druntime, not Phobos.
Re: Threading Questions
On Tuesday, 29 September 2015 at 19:10:58 UTC, Steven Schveighoffer wrote: An object that implements the Monitor interface may not actually be a mutex. For example, a pthread_cond_t requires a pthread_mutex_t to operate properly. Right! I feel like I should have caught the fact that ConditionVariable still has to use pthread_cond_t under the hood, and adopts all of it's behaviour and requirements as a result. 4. Technically, you shouldn't access member variables that are GC allocated from a dtor. I know it's a struct, but structs can be GC allocated as well. Right forgot about that. GC's are really beginning to get on my nerves.. IMO, RAII for GC is a horrible tradeoff. I'm still not sure I would like Rust, but their memory model is making it a very enticing proposition. I'm almost at the point where I just don't care how much convenience, or familiarity D can offer in other areas.. Its starting to seem like none of it is worth it with a GC-based memory model standing in the way. Maybe this is an exageration...D has a lot of great features..but it's the net benefit that will ultimately determine whether or not people use D. I use C#(garbage collected) for making apps/games, and while, _in_theory_, the GC is supposed to protect you from leaks, memory is not the only thing that can leak. Threads need to be stopped, graphics resources need to be released, etc.. So when I can't rely on RAII to free these things, I need to free them explicitly, which basically puts me right back where I started. Anyways, I realize this will probably be buried 3 pages deep in D-Learn by Monday, but at least I feel better :) Bit
Re: Cameleon: Stricter Alternative Implementation of VariantN
On Monday, 21 September 2015 at 13:42:14 UTC, Nordlöw wrote: The code is here: https://github.com/nordlow/justd/blob/master/cameleon.d Moved to https://github.com/nordlow/justd/blob/master/vary.d Templates are no called: - FastVariant - PackedVariant
Re: OT: interesting talk by Jane Street technical guy on why they used Ocaml
On Sunday, 4 October 2015 at 00:45:16 UTC, Mengu wrote: i watched this talk by yaron last year when i was looking at alternatives for sml. i was taking the programming languages course on coursera by dan grossman. ocaml looked like it tooked off at the beginning of 2000s but then due to many problems it failed to be a mainstream language. interesting, thanks. I played with ocaml a little, but simply didn't have time to do more than that. I was interested in the commercial aspects of his experience, as that happens to resonate with my own experience. imho, D will never take off like go or rust because people who adopted these languages are mostly python and ruby developers. rust is only barely out of beta, and doesn't yet seem to be used in many enterprises, whereas D's status is rather different given the size of firms built on it. I know what you mean about perceptions, and that perhaps may change now you have two of the best C++ programmers working on it fulltime, and not just one ;) D has an incredibly creative and helpful community yet our community is not as enthusiastic as go's and rust's community. why do you think that is ? one reason might be different kind of use cases. one has a different emotional experience and draws different kinds of people for some kinds of projects than others, and that's surely reflected in the tone of the community. also things just have their own spirit, and that is what it is, and enthusiasm can be a positive thing, but isn't without drawbacks either. I'd say I am impressed by the sheer grit people have, and that's something important too. phobos is extremely a great library yet not very welcoming and feels overly complicated. we should reduce the amount of WTFs when reading the phobos source and docs. look at the rate of change as well as the level. the docs could be better, and we could have more blog posts. but picture is much better than when I first looked at D a couple of years back. I remember trying for ages just to get std.net.curl to work and almost giving up in despair. (I noticed recently docs were still wrong, so I fixed them). we should give ourselves credit for the distance travelled, even if there's a long road further to get to where we want. Laeeth.