Recommendation for parallelism with nested for loops?

2022-08-18 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. I want to parallelize a computation which has two for loops, one nested within another. All inner-loop-param+outer-loop-param combinations can be computed independent of one another. As I suspected, [https://forum.dlang.org/post/xysyidbkjdinclmrx...@forum.dlang.org](this forum post)

Re: termcolor-d - Colors with writeln(...);

2018-11-22 Thread Shriramana Sharma via Digitalmars-d-announce
On Wednesday, 21 November 2018 at 18:36:06 UTC, Vladimirs Nordholm wrote: https://github.com/vladdeSV/termcolor-d https://github.com/jamadagni/textattr/ Saw a library recently which allowed you to color text, but it had an odd syntax. Maybe the documentation, in trying to be exhaustive,

Re: textattr library for text colors and attributes available in D

2018-11-22 Thread Shriramana Sharma via Digitalmars-d-announce
On Friday, 9 November 2018 at 22:28:28 UTC, JN wrote: It looks to me like the textattr.d is all that is needed? Should be easy to put it in a separate package that could be uploaded to dub registry. Yes indeed textattr.d is all that is needed! For C too textattr.c|h are all that are needed.

Re: textattr library for text colors and attributes available in D

2018-11-08 Thread Shriramana Sharma via Digitalmars-d-announce
On Thursday, 8 November 2018 at 19:26:15 UTC, Bastiaan Veelo wrote: Cool, must remember this in case I need it one day. Do you have plans to add it to the dub registry? Don't know how. Can follow instructions if provided. Does DUB also allow multi-language libs one of which is D?

textattr library for text colors and attributes available in D

2018-11-08 Thread Shriramana Sharma via Digitalmars-d-announce
++ and Python use the C code for internal processing but the D code is a separate implementation for easy inclusion of textattr.d in a D compilation command without requiring any external linking. Copyright: Shriramana Sharma, 2018 License: BSD-2-Clause

Re: Getting a safe path for a temporary file

2017-10-27 Thread Shriramana Sharma via Digitalmars-d-learn
On Wednesday, 25 October 2017 at 00:35:29 UTC, Ali Çehreli wrote: > char[] name = "/tmp/XX".dup; remain valid. The actual issue is the missing '\0'. So, consider toStringz in this case: https://dlang.org/library/std/string/to_stringz.html Thanks for your reply, but can you clarify

Why is length being tested on an int?

2017-10-27 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. I want a function to be able to take any arguments like write() and print them out but quoting string arguments of length more than 1. So I write the following quote: import std.stdio; string myFunc(string arg) { return '\"' ~ arg ~ '\"'; } void myWrite(T ...)(T args) { foreach

Re: Getting a safe path for a temporary file

2017-10-22 Thread Shriramana Sharma via Digitalmars-d-learn
On Sunday, 22 October 2017 at 15:21:37 UTC, Shriramana Sharma wrote: For my program right now I'm using a souped-up version using a static array: char[20] name = "/tmp/XX"; Hmm I was wondering if I needed it to be static, and verily, substituting: char[] name = "/

Re: Getting a safe path for a temporary file

2017-10-22 Thread Shriramana Sharma via Digitalmars-d-learn
On Saturday, 17 January 2015 at 17:16:41 UTC, Tobias Pankrath wrote: You're looking for core.sys.posix.stdlib : mkstemp. I think that should be used by std.stdio.File as well, care to create an enhancement request in bugzilla? Though this thread is old, I ran into the issue when wanting to

Re: Can't use function with same name as module?

2017-10-17 Thread Shriramana Sharma via Digitalmars-d-learn
Have reported https://issues.dlang.org/show_bug.cgi?id=17907

Re: Can't use function with same name as module?

2017-10-17 Thread Shriramana Sharma via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 08:26:12 UTC, Daniel Kozak wrote: You can: import fun : fun; Yes I found this but it is unnecessarily verbose. At the same time I also find that it is possible to declare a struct or class with the same name as module: str.d: struct str { int a; } strmain.d:

Re: Can't use function with same name as module?

2017-10-17 Thread Shriramana Sharma via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 07:33:15 UTC, evilrat wrote: Compiler made that way so it doesn't guess or assume too much, because later on it will bite you when you don't even expect that, and in some unpredictable place too. Can you give an example for when it will bite me? It seems very

Can't use function with same name as module?

2017-10-17 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. fun.d: import std.stdio; void fun() { writeln("Hello"); } main.d: import fun; void main() { fun(); } $ dmd -oftest fun.d main.d main.d(2): Error: function expected before (), not module fun of type void Why can't I use a function of the same name as the module? IIUC import fun

Re: Template version of ANSI color code lib useful?

2017-10-14 Thread Shriramana Sharma via Digitalmars-d
On Saturday, 14 October 2017 at 17:17:41 UTC, Petar Kirov [ZombineDev] wrote: Why not simply add extern (C) wrappers for your D code? I see no point of using C, unless you want to be portable to arcane architectures. With this approach you'll have both the portability of C and the advantages

Re: Template version of ANSI color code lib useful?

2017-10-14 Thread Shriramana Sharma via Digitalmars-d
On Saturday, 14 October 2017 at 14:51:12 UTC, Adam D. Ruppe wrote: My terminal.d works with most that stuff. Yes I did look into existing solutions. Mainly my desire was not to work in D alone but something available at command line and as a library for shell-scripts and other languages too.

Template version of ANSI color code lib useful?

2017-10-14 Thread Shriramana Sharma via Digitalmars-d
Hello. I prepared a utility/library to output ANSI escape codes for terminal text attributes with capabilities as advertised at https://sites.google.com/site/jamadagni/files/temp/textattr-usage.html. (AFAIK this set of capabilities does not exist already in any existing package.) This was

Re: Unable to instantiate template with same name as function

2016-03-04 Thread Shriramana Sharma via Digitalmars-d-learn
s = ta("s)"; > > and using s all over the place will result in an allocation each time that > s is used. However, you can combine the two and avoid that problem. e.g. > > enum e = ta("s"); > string s = e; > > The ta is run at compile time, and it's only evaluated once. -- Shriramana Sharma, Penguin #395953

Re: Unable to instantiate template with same name as function

2016-03-04 Thread Shriramana Sharma via Digitalmars-d-learn
ag0aep6g wrote: > On 03.03.2016 07:12, Shriramana Sharma wrote: >> string ta(string s) { return s ~ "1"; } >> template ta(string s) { enum ta = ta(s); } > > In `ta(s)` here, `ta` is the enum itself again. It's similar to `int x = > x;`. Can't do that, of cours

Re: Unable to instantiate template with same name as function

2016-03-04 Thread Shriramana Sharma via Digitalmars-d-learn
cted. Filed https://issues.dlang.org/show_bug.cgi?id=15764 just for the record. -- Shriramana Sharma, Penguin #395953

Re: Unable to instantiate template with same name as function

2016-03-03 Thread Shriramana Sharma via Digitalmars-d-learn
name approach, so it brings us back to the question as to why the name can't be re-used. -- Shriramana Sharma, Penguin #395953

Unable to instantiate template with same name as function

2016-03-02 Thread Shriramana Sharma via Digitalmars-d-learn
r: template instance .ta!"s" error instantiating Please clarify what I am doing wrong? Thanks! -- Shriramana Sharma, Penguin #395953

`static` symbol needs to be `immutable` for compile-time access?

2016-01-22 Thread Shriramana Sharma via Digitalmars-d-learn
to a template at compile time, and I (for obvious reasons) don't want to be initialized at every function call, do I have to declare it `static immutable`? -- Shriramana Sharma, Penguin #395953

Re: `static` symbol needs to be `immutable` for compile-time access?

2016-01-22 Thread Shriramana Sharma via Digitalmars-d-learn
cation) every time the function is run? -- Shriramana Sharma, Penguin #395953

Re: mixed-in ctor not on par with explicit one?

2016-01-13 Thread Shriramana Sharma via Digitalmars-d-learn
'this' (9): Error: cannot use syntax 'alias this = myCtorsInst', use 'alias myCtorsInst this' instead This is not what alias <> this is supposed to do, right? So how am I supposed to get the mixed in ctors work? -- Shriramana Sharma, Penguin #395953

Re: mixed-in ctor not on par with explicit one?

2016-01-13 Thread Shriramana Sharma via Digitalmars-d-learn
Jacob Carlborg wrote: > Looks like a limitation in the language. Apparently already reported as well: https://issues.dlang.org/show_bug.cgi?id=11500 -- Shriramana Sharma, Penguin #395953

Compiler complaining about ~ used on static array in @nogc fn

2016-01-13 Thread Shriramana Sharma via Digitalmars-d-learn
g that I cannot use ~ inside a @nogc function? -- Shriramana Sharma, Penguin #395953

mixed-in ctor not on par with explicit one?

2016-01-12 Thread Shriramana Sharma via Digitalmars-d-learn
g argument types (int) What is the problem in calling the mixed-in ctor? -- Shriramana Sharma, Penguin #395953

immutable promise broken in unions?

2016-01-02 Thread Shriramana Sharma via Digitalmars-d-learn
of `immutable` was: never changes, whether via this interface or otherwise. How does then the above work? Using DMD 2.0.69.2 on Kubuntu 64 bit. -- Shriramana Sharma, Penguin #395953

Re: immutable promise broken in unions?

2016-01-02 Thread Shriramana Sharma via Digitalmars-d-learn
eded to make such a union. But already making a union is breaking the type system in a way, no? -- Shriramana Sharma, Penguin #395953

Re: Why isn't field-wise constructor automatic for structs and not classes?

2016-01-02 Thread Shriramana Sharma via Digitalmars-d-learn
John Colvin wrote: > Strictly speaking you aren't calling a constructor there, you're > writing a struct literal. Why do you say I'm not calling a constructor? And that still doesn't answer the question of why can't we have an automatic field-wise constructor for classes... -- Shri

Re: @property not available for classes?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
John wrote: > It's nothing to do with the @property attribute. So you need to > define a constructor. Also, use "new" when creating instances. Thanks Simon and John. First actual usage of D classes and mistaken assumption that C++ syntax is valid. :-) -- Shriramana Sharma, Penguin #395953

Why can't a Regex object be immutable?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
: std.regex.matchAll(R, RegEx)(R input, RegEx re) if (isSomeString!R && is(RegEx == StaticRegex!(BasicElementOf!R))) If I use `auto` all is fine. Why is it impossible for a Regex object to be `immutable`? -- Shriramana Sharma, Penguin #395953

Re: Why can't a Regex object be immutable?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
Shriramana Sharma wrote: > Why is it impossible for a Regex object to be > `immutable`? I find that I can't declare it as `const` either... This is most curious! -- Shriramana Sharma, Penguin #395953

Why isn't field-wise constructor automatic for structs and not classes?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
defined. Why can't the field-wise functionality be automatic for classes too? -- Shriramana Sharma, Penguin #395953

Re: Why can't a Regex object be immutable?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
much that I cannot create an immutable or const symbol referring to a Regex object but that I cannot use it with matchAll etc. But of what use is a Regex object if it cannot be used with matchAll etc? -- Shriramana Sharma, Penguin #395953

Re: Why can't a Regex object be immutable?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
re it immutable for > example. I didn't look at the implementation to identify a > precise cause though. You mean ctRegex!(), but nope: immutable numbers = ctRegex!r"\d+"; or doing const there gives the same error and using auto doesn't. -- Shriramana Sharma, Penguin #395953

Re: CTFE with C functions not possible?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
MD had something like -fdata-sections -ffunction- sections, passing --gc-sections might be able to slim that down, I dunno... -- Shriramana Sharma, Penguin #395953

Re: CTFE with C functions not possible?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
bulky. I suppose I could always maintain both the C and D versions separately. -- Shriramana Sharma, Penguin #395953

@property not available for classes?

2016-01-01 Thread Shriramana Sharma via Digitalmars-d-learn
applicable for classes. Am I stuck with having to use the () for this even in D? -- Shriramana Sharma, Penguin #395953

Re: CTFE with C functions not possible?

2015-12-31 Thread Shriramana Sharma via Digitalmars-d-learn
ylib and all that, but of course now I realize that that is only telling the *linker* about the lib. How do I tell the compiler to the lib? If Python CTypes can query and find out any library with the SO filename I throw at it, can't a D compiler? -- Shriramana Sharma, Penguin #395953

Re: CTFE with C functions not possible?

2015-12-31 Thread Shriramana Sharma via Digitalmars-d-learn
Shriramana Sharma wrote: > What I desire to do is be able to call a C library from a D template like > octal to compute a string at compile time. To be more explicit, I wrote a library in C since it's much leaner size-wise than the D code (although admittedly much *much* more tedious to

CTFE with C functions not possible?

2015-12-31 Thread Shriramana Sharma via Digitalmars-d-learn
: 1) Why exactly can't the compiler call a C function at compile time whereas it can call a D function? 2) ... which itself only in the end calls that very same C function IIANM? I see druntime/import/core/math.d l 91: double sqrt(double x); /* intrinsic */ -- Shriramana Sharma, Penguin

Re: CTFE with C functions not possible?

2015-12-31 Thread Shriramana Sharma via Digitalmars-d-learn
n libc? -- Shriramana Sharma, Penguin #395953

Re: CTFE with C functions not possible?

2015-12-31 Thread Shriramana Sharma via Digitalmars-d-learn
Rikki Cattermole wrote: > It will make it very hard to split std.math up. I have no desire to split std.math up. :-) What I desire to do is be able to call a C library from a D template like octal to compute a string at compile time. Is this possible or not? -- Shriramana Sharma, Peng

Is a type not a symbol?

2015-12-22 Thread Shriramana Sharma via Digitalmars-d-learn
http://dlang.org/spec/template.html#TemplateTupleParameter says that an AliasSeq (wording needs to be updated) "is a sequence of any mix of types, expressions or symbols." Is a type not a symbol? I mean, alias can refer to both, no? -- Shriramana Sharma, Penguin #395953

: in template specialization vs constraint

2015-12-22 Thread Shriramana Sharma via Digitalmars-d-learn
of specialization means an exact match but in the context of constraints it means implicitly convertible, no? The specialization section under http://dlang.org/spec/template.html is not very clear about this IMHO. -- Shriramana Sharma, Penguin #395953

Re: Slicing AliasSeq-s

2015-12-22 Thread Shriramana Sharma via Digitalmars-d
a new tuple that refers to the same > objects as the previous one. So it doesn't deep copy... but > remember this is irrelevant to any D program I realize that but just wanted to know whether the word slicing is used in this context in the same sense as elsewhere. -- Shriramana Sharma, Penguin #395953

Re: Template specialization using traits?

2015-12-21 Thread Shriramana Sharma via Digitalmars-d-learn
e name and complementary constraints right? -- Shriramana Sharma, Penguin #395953

Re: C string to D without memory allocation?

2015-12-21 Thread Shriramana Sharma via Digitalmars-d-learn
marked @system? Only because one cannot be sure that the input point refers to a valid null-terminated string? -- Shriramana Sharma, Penguin #395953

Deimos recommendation still official?

2015-12-21 Thread Shriramana Sharma via Digitalmars-d-learn
. Or is it just because the other C libraries haven't changed (!)... -- Shriramana Sharma, Penguin #395953

Slicing AliasSeq-s

2015-12-21 Thread Shriramana Sharma via Digitalmars-d
since it relates to compiler internals.) -- Shriramana Sharma, Penguin #395953

Template specialization using traits?

2015-12-21 Thread Shriramana Sharma via Digitalmars-d-learn
a single type, I know I have to put the specialization as in: void func(T: int)(T t) { writeln(2); } and that works, but how to make it more generic than that? -- Shriramana Sharma, Penguin #395953

What other than a pointer can be converted implicitly to const(char)*?

2015-12-21 Thread Shriramana Sharma via Digitalmars-d-learn
convertible to const(char)*? -- Shriramana Sharma, Penguin #395953

Re: function without "this" cannot be const?

2015-12-20 Thread Shriramana Sharma via Digitalmars-d-learn
Basile B. wrote: > without the parens, 'const' means that the function doesn't > mutate the state of the object or of the struct it's declared in. > So it's meaningless for a global function. Thank you people. -- Shriramana Sharma, Penguin #395953

C string to D without memory allocation?

2015-12-20 Thread Shriramana Sharma via Digitalmars-d-learn
afe D type encapsulating a C string but avoid allocation – is it possible or not? Thanks! -- Shriramana Sharma, Penguin #395953

function without "this" cannot be const?

2015-12-20 Thread Shriramana Sharma via Digitalmars-d-learn
I'm trying to interface to a C function: extern(C) const char * textAttrN(const char * specString, size_t n); and getting the error: Error: function .textAttrN without 'this' cannot be const Please advise as to what I'm doing wrong?! :-( -- Shriramana Sharma, Penguin #395953

Re: C string to D without memory allocation?

2015-12-20 Thread Shriramana Sharma via Digitalmars-d-learn
Rikki Cattermole wrote: > string myCString = cast(string)ptr[0 .. strLen]; Thanks but does this require that one doesn't attempt to append to the returned string using ~= or such? In which case it is not safe, right? -- Shriramana Sharma, Penguin #395953

Re: C string to D without memory allocation?

2015-12-20 Thread Shriramana Sharma via Digitalmars-d-learn
> > it is a poor design. fromStringz > is explicit about this assumption. OK thank you. -- Shriramana Sharma, Penguin #395953

Re: exit(1)?

2015-12-17 Thread Shriramana Sharma via Digitalmars-d-learn
Jakob Ovrum wrote: > The example should be restructured to `return 1;` > from `main`. https://github.com/D-Programming-Language/phobos/pull/3875 -- Shriramana Sharma, Penguin #395953

Re: Why should file names intended for executables be valid identifiers?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
not be a valid identifier no? -- Shriramana Sharma, Penguin #395953

Re: Testing if a file is connected to a terminal

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
Jakob Ovrum wrote: > Where's the reference documentation? There's a README: http://code.dlang.org/packages/consoled, and the source does seem to have DDoc comments... -- Shriramana Sharma, Penguin #395953

exit(1)?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
http://dlang.org/phobos/std_getopt.html has a line in an example saying exit(1); Surely this works only if core.stdc.stdlib is imported? Should the example be modified to show the import? And is exit() the canonical way to exit the current process even in D? -- Shriramana Sharma, Penguin

Re: No documentation for core.sys?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
oposed library documentation, core.stdc is mentioned: https://dlang.org/library/index.html, but core.sys.posix is not... [sigh] This is why D's API version is still 0, as in 2.0.69.2 (at least my interpretation of the weird zero-prefixed numbering being used). -- Shriramana Sharma, Penguin #395953

No documentation for core.sys?

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
In my recent search for D's equivalent of isatty, I found out that there is a core.sys.posix module only by rgrepping under /usr/include/dmd. Why isn't there a documentation page http://dlang.org/phobos/core_sys.html whereas lots of other core.* modules are documented? -- Shriramana Sharma

Testing if a file is connected to a terminal

2015-12-16 Thread Shriramana Sharma via Digitalmars-d-learn
under core.sys.posix.unistd, and I suppose I can just pass to it the output of std.stdio.File.getFP. Is there any other way to do the desired test? Or is this the recommended way? -- Shriramana Sharma, Penguin #395953

Re: isExpressions -> isValuesSeq

2015-12-14 Thread Shriramana Sharma via Digitalmars-d
son, alias sequences can not "contain" or "encapsulate" expressions in un-evaluated form in any way (unlike, say http://docs.sympy.org/dev/modules/core.html#sympy.core.mul.Mul) in that the components of the expression are lost by the time the AliasSeq gets defined. -- Shr

Why should file names intended for executables be valid identifiers?

2015-12-14 Thread Shriramana Sharma via Digitalmars-d-learn
is not a module being imported by anything else or even being compiled to a library which would need to be later imported. In which case, why does it insist that the file should be given a valid module name? -- Shriramana Sharma, Penguin #395953

Inferring an integer literal as ubyte

2015-12-14 Thread Shriramana Sharma via Digitalmars-d-learn
to be inferred as an `int`. I thought that integer literals used to be inferred as the smallest integral type that can fit them – am I mistaken? -- Shriramana Sharma, Penguin #395953

Re: Inferring an integer literal as ubyte

2015-12-14 Thread Shriramana Sharma via Digitalmars-d-learn
Adam D. Ruppe wrote: > but yours won't because to!ubyte(spec, 6) might just be > 240. Thanks for that explanation. That's clear now. -- Shriramana Sharma, Penguin #395953

Better string representation for TypeSeq used as function arg type?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d
that the AliasSeq is presented to the function body *as if* it were a Tuple!(int, double) in that it can be accessed using [0] [1] etc, but it is not *really* (in the sense of RTTI) a Tuple, is it? In which case, what is it? Is it another "Voldemort" type? -- Shriramana Sharma, Penguin #395953

What is the utility of .stringof with expressions?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d
2).stringof); all print "1 + 2" (without the quotes) so it's not a simple compiler dumps to string thing, but still I don't understand what this can be useful for... -- Shriramana Sharma, Penguin #395953

Re: Better string representation for TypeSeq used as function arg type?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d
mentary" topic, I asked it here. I posted some "elementary" questions to D.learn even yesterday... -- Shriramana Sharma, Penguin #395953

Re: What is the utility of .stringof with expressions?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d
urself... -- Shriramana Sharma, Penguin #395953

Re: isExpressions -> isValuesSeq

2015-12-12 Thread Shriramana Sharma via Digitalmars-d
Seq stores only the resultant value of the expression and not the expression itself (which may be valid or not). -- Shriramana Sharma, Penguin #395953

AliasSeq can contain template identifier too?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d-learn
... -- Shriramana Sharma, Penguin #395953

isTemplate and isValue?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d-learn
or not, what should I use to determine whether something is a value or not? These would be useful to identify the kind of a member of an AliasSeq... -- Shriramana Sharma, Penguin #395953

Re: Better string representation for TypeSeq used as function arg type?

2015-12-12 Thread Shriramana Sharma via Digitalmars-d
cym13 wrote: > So, no, it's not a Voldemort type, it's exactly what the compiler > tells you it is: the sequence of types (int, double). Hmmm it seems to me that if it's not a runtime-valid type, then typeof() shouldn't work at all... -- Shriramana Sharma, Penguin #395953

Re: %s not producing string representation of enum?

2015-12-11 Thread Shriramana Sharma via Digitalmars-d-learn
Ali Çehreli wrote: > http://ddili.org/ders/d.en/enum.html#ix_enum.EnumMembers,%20std.traits Ali that's great! Thank you! -- Shriramana Sharma, Penguin #395953

Re: Using std.math: FloatingPointControl.enableExceptions

2015-12-11 Thread Shriramana Sharma via Digitalmars-d-learn
rumbu wrote: > Constant folding: a is evaluated at compile time to + infinity. Hmm... I guess the compiler figures that if someone is hardcoding that expression then they don't want to see an exception. Thanks for the explanation. -- Shriramana Sharma, Penguin #395953

Replacing .tupleof

2015-12-11 Thread Shriramana Sharma via Digitalmars-d
? -- Shriramana Sharma, Penguin #395953

How is `auto` and not `alias` appropriate for alias sequences?

2015-12-11 Thread Shriramana Sharma via Digitalmars-d
is situation? Thanks. -- Shriramana Sharma, Penguin #395953

Re: How is `auto` and not `alias` appropriate for alias sequences?

2015-12-11 Thread Shriramana Sharma via Digitalmars-d
ple = Tuple!(int, string); FooTuple footu = FooTuple(1, "one"); auto ttp = -- Shriramana Sharma, Penguin #395953

Re: How is `auto` and not `alias` appropriate for alias sequences?

2015-12-11 Thread Shriramana Sharma via Digitalmars-d
r a "Like" or "Upvote" button on this forum. :-) Thanks! -- Shriramana Sharma, Penguin #395953

isExpressions -> isValuesSeq

2015-12-11 Thread Shriramana Sharma via Digitalmars-d
;foo" == "goo" Clearly, the AliasSeq is not able to store the expressions themselves since they are automatically evaluated at compile time. It stores only the values that the expressions evaluate to. Further, expressions which are not evaluable at compile time aren't permitted in t

Re: How is `auto` and not `alias` appropriate for alias sequences?

2015-12-11 Thread Shriramana Sharma via Digitalmars-d
act nature of the object produced by .tupleof is still a mystery to me. Would be good if someone threw more light on it. Also: what is the use of presenting the members of a struct/class as a tuple? Is it iteration? -- Shriramana Sharma, Penguin #395953

Using std.math: FloatingPointControl.enableExceptions

2015-12-10 Thread Shriramana Sharma via Digitalmars-d-learn
std.stdio; import std.math; void main() { FloatingPointControl fc; fc.enableExceptions(fc.severeExceptions); real a = 1.0 / 0.0; writeln(ieeeFlags.divByZero); } -- Shriramana Sharma, Penguin #395953

std.math: FloatingPointControl option to round to nearest + tie away from zero

2015-12-10 Thread Shriramana Sharma via Digitalmars-d
roundToNearest which, I presume, ties to even. Is there a difficulty in providing the option for tieing away from zero? Thanks. -- Shriramana Sharma, Penguin #395953

Documentation of std.math: FloatingPointControl

2015-12-10 Thread Shriramana Sharma via Digitalmars-d
not clear what subnormalException refers to. Is it the "denormal operand exception" mentioned at https://docs.oracle.com/cd/E19957-01/806-3568/ncg_handle.html? Thanks. -- Shriramana Sharma, Penguin #395953

Re: %s not producing string representation of enum?

2015-12-10 Thread Shriramana Sharma via Digitalmars-d-learn
embers. This will both help avoid the above hack and only then will his reference to %s and %d having different effects for enums be true... Thanks once more to Ali for his book and you people for the replies! -- Shriramana Sharma, Penguin #395953

%s not producing string representation of enum?

2015-12-10 Thread Shriramana Sharma via Digitalmars-d-learn
uot;, suit); } } But I'm getting 0 1 2 3. Kindly advise. -- Shriramana Sharma, Penguin #395953

Short-circuit evaluation in D

2015-11-21 Thread Shriramana Sharma via Digitalmars-d
ut D than me to do the edit and respond here too. Thanks. -- Shriramana Sharma, Penguin #395953

Re: D equivalent of Python's try..else

2015-11-21 Thread Shriramana Sharma via Digitalmars-d-learn
n `switch`) is not executed if `break` happens. So: try { code_which_can_throw(); } catch { handler(); } default { only_if_didnt_throw(); } finally { mandatory(); } How does that look? -- Shriramana Sharma, Penguin #395953

why --shebang for rdmd?

2015-11-20 Thread Shriramana Sharma via Digitalmars-d-learn
Hello. The following code works fine for me: #! /usr/bin/env rdmd import std.stdio; void main() { writeln(2); } So what is the use of the --shebang option of rdmd? http://dlang.org/rdmd.html does not shed much light on this. Thanks. -- Shriramana Sharma, Penguin #395953

Re: D equivalent of Python's try..else

2015-11-20 Thread Shriramana Sharma via Digitalmars-d-learn
a D equivalent? -- Shriramana Sharma, Penguin #395953

Re: D equivalent of Python's try..else

2015-11-20 Thread Shriramana Sharma via Digitalmars-d-learn
Shriramana Sharma wrote: > In Python one has the syntax try..except..else.. where code in the > else clause will only be executed if an exception does not occur. (Ref: > http://stackoverflow.com/a/22579805/1503120) Official Python documentation: https://docs.python.org/3/

D equivalent of Python's try..else

2015-11-20 Thread Shriramana Sharma via Digitalmars-d-learn
(apart from catch). -- Shriramana Sharma, Penguin #395953

`finally` is redundant?

2015-11-20 Thread Shriramana Sharma via Digitalmars-d-learn
The page http://dlang.org/exception-safe.html says: "It's try-finally that becomes redundant." IIUC this is because we have scope(exit). Does this mean that `finally` should eventually be removed from the language? -- Shriramana Sharma, Penguin #395953

Re: Please vote for the DConf logo

2015-11-10 Thread Shriramana Sharma via Digitalmars-d-announce
the message of 1. The graphic is too complicated, and the significance of its components is not self-evident. Appreciate the work people are putting into this, though. No offence to any artist intended... -- Shriramana Sharma, Penguin #395953

Dhee - tiny app to learn/try out D

2015-11-10 Thread Shriramana Sharma via Digitalmars-d-learn
cross-posted as I thought this is relevant to both announce/learn. -- Shriramana Sharma, Penguin #395953

Dhee - tiny app to learn/try out D

2015-11-10 Thread Shriramana Sharma via Digitalmars-d-announce
cross-posted as I thought this is relevant to both announce/learn. -- Shriramana Sharma, Penguin #395953

  1   2   3   >