digitalmars.D - The amazing template which does nothing
- Vladimir Panteleev (1/1) Apr 27 2015 http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-doe...
- Andrei Alexandrescu (4/5) Apr 27 2015 s/which/that/
- Vladimir Panteleev (3/8) Apr 27 2015 Fixed, thanks.
- Chris (11/12) Apr 28 2015 Thanks for this little piece of information! Great stuff. You
- Andrea Fontana (5/8) Apr 28 2015 A very slow (i guess) workaround could be:
- John Colvin (4/13) Apr 28 2015 Shouldn't be slow, your just giving the optimiser some work to
- John Colvin (2/19) Apr 28 2015 s/your/you're
- Andrea Fontana (6/28) Apr 28 2015 Trying on d.godbolt.com it seems a lot of extra-code is generated
- John Colvin (6/36) Apr 28 2015 The d.godbolt.org compilers seem a little out of date. I have
- Vladimir Panteleev (2/4) Apr 28 2015 d.godbolt.com is dead, use asm.dlang.org
- John Colvin (4/8) Apr 29 2015 d.godbolt.org (note .org not .com) works fine and will be updated
- Iain Buclaw via Digitalmars-d (6/15) Apr 29 2015 the first version.
- John Colvin (4/27) Apr 29 2015 Did you check the dropdown menu? There's 4.9 in there.
- Iain Buclaw via Digitalmars-d (3/34) Apr 29 2015 Ah! I was on my phone and didn't notice. :-O
- Vladimir Panteleev (3/13) Apr 29 2015 Ah, my bad! I know Iain was involved so I thought it had GDC as
- Iain Buclaw via Digitalmars-d (12/28) Apr 29 2015 DMD and GDC don't generate compatible outputs, so it's not that
- John Colvin (3/17) Apr 29 2015 d.godbolt.org now has the latest release as default.
- Iain Buclaw via Digitalmars-d (4/25) Apr 29 2015 I take it you've been speaking to the site maintainer? :o)
- John Colvin (2/36) Apr 30 2015 Yes and yes.
- Iain Buclaw via Digitalmars-d (4/47) Apr 30 2015 You could have waited a month for gdc-5 to come out of experimental...
- Andrea Fontana (3/12) Apr 28 2015 Using std.functional:
- Dicebot (8/9) Apr 28 2015 Very nice. There is also a similar package protected template in
- Andrei Alexandrescu (8/9) Apr 28 2015 Went to post on reddit, was there already:
- Vladimir Panteleev (5/10) Apr 28 2015 Thank you, though the article is kinda targeted at experienced D
- Steven Schveighoffer (4/5) Apr 28 2015 Very cool.
- Vladimir Panteleev (4/9) Apr 28 2015 Fixed, thanks. (I always found this rule counter-intuitive... "u"
- Steven Schveighoffer (8/19) Apr 28 2015 And in most cases, 'an' is correct. It's only when it makes a "you"
- Chris (21/43) Apr 29 2015 Yeah, because the sound in `you` or the letter is not a full
- Vladimir Panteleev (6/9) Apr 29 2015 Yes, well, the problem is that "an U" sounds completely fine in
- Chris (8/17) Apr 29 2015 In that case you'll just have to learn the rule: if it's a single
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (6/25) Apr 29 2015 Can't answer that question, but <Ю> is actually [ju] in
- Chris (7/33) Apr 29 2015 Hm, a glide is not necessarily a fricative. In English the /j/
- Max Samukha (14/15) Apr 28 2015 A truly polymorphic identity function in D would be more involved:
- Dicebot (5/21) Apr 28 2015 Actually I do find more specialized names/implementations useful
- Nikolay (12/13) Apr 28 2015 Thanks for good article
- Vladimir Panteleev (4/17) Apr 29 2015 Fixed, thanks. Though, you technically still can use "return
http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/
Apr 27 2015
On 4/27/15 7:36 PM, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/s/which/that/ Simple rule of thumb: if there's no comma before "which", consider replacing with "that". -- Andrei
Apr 27 2015
On Tuesday, 28 April 2015 at 06:10:28 UTC, Andrei Alexandrescu wrote:On 4/27/15 7:36 PM, Vladimir Panteleev wrote:Fixed, thanks.http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/s/which/that/ Simple rule of thumb: if there's no comma before "which", consider replacing with "that". -- Andrei
Apr 27 2015
On Tuesday, 28 April 2015 at 02:36:38 UTC, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Thanks for this little piece of information! Great stuff. You wrote "When building an UFCS chain (in the style of component programming), you will often run into situations where a certain operation is not UFCS-able. There are multiple obvious ways to prepend the string, but neither are very satisfactory" And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.
Apr 28 2015
On Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.A very slow (i guess) workaround could be: "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln; vs the new one: "test".toUpper.Identity!(a => "This is a " ~ a).writeln;
Apr 28 2015
On Tuesday, 28 April 2015 at 10:07:43 UTC, Andrea Fontana wrote:On Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:Shouldn't be slow, your just giving the optimiser some work to do*, but you're always better off with the second one. *Assuming a good optimiser. dmd won't work this out.And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.A very slow (i guess) workaround could be: "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln; vs the new one: "test".toUpper.Identity!(a => "This is a " ~ a).writeln;
Apr 28 2015
On Tuesday, 28 April 2015 at 10:18:12 UTC, John Colvin wrote:On Tuesday, 28 April 2015 at 10:07:43 UTC, Andrea Fontana wrote:s/your/you'reOn Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:Shouldn't be slow, your just giving the optimiser some work to do*, but you're always better off with the second one. *Assuming a good optimiser. dmd won't work this out.And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.A very slow (i guess) workaround could be: "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln; vs the new one: "test".toUpper.Identity!(a => "This is a " ~ a).writeln;
Apr 28 2015
On Tuesday, 28 April 2015 at 10:18:49 UTC, John Colvin wrote:On Tuesday, 28 April 2015 at 10:18:12 UTC, John Colvin wrote:Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version. Anyway I think I'm going to rename it "apply". :) "test".toUpper.apply!(a => "This is a " ~ a).writeln; It sounds better.On Tuesday, 28 April 2015 at 10:07:43 UTC, Andrea Fontana wrote:s/your/you'reOn Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:Shouldn't be slow, your just giving the optimiser some work to do*, but you're always better off with the second one. *Assuming a good optimiser. dmd won't work this out.And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.A very slow (i guess) workaround could be: "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln; vs the new one: "test".toUpper.Identity!(a => "This is a " ~ a).writeln;
Apr 28 2015
On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:On Tuesday, 28 April 2015 at 10:18:49 UTC, John Colvin wrote:The d.godbolt.org compilers seem a little out of date. I have found problems with their codegen/optimisation that doesn't happen in more recent versions. ldc 0.15.2 based on llvm 3.5.1 reduces both chains to identical asm.On Tuesday, 28 April 2015 at 10:18:12 UTC, John Colvin wrote:Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version. Anyway I think I'm going to rename it "apply". :) "test".toUpper.apply!(a => "This is a " ~ a).writeln; It sounds better.On Tuesday, 28 April 2015 at 10:07:43 UTC, Andrea Fontana wrote:s/your/you'reOn Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:Shouldn't be slow, your just giving the optimiser some work to do*, but you're always better off with the second one. *Assuming a good optimiser. dmd won't work this out.And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.A very slow (i guess) workaround could be: "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln; vs the new one: "test".toUpper.Identity!(a => "This is a " ~ a).writeln;
Apr 28 2015
On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 28 2015
On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 29 2015
On 29 Apr 2015 09:05, "John Colvin via Digitalmars-d" < digitalmars-d puremagic.com> wrote:On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:the first version.On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:Trying on d.godbolt.com it seems a lot of extra-code is generated forlatest GDC shortly. asm.dlang.org only has DMD. Well it's using frontend 2.055, which I guess would put it at gdc-4.6 in Debian repos.d.godbolt.com is dead, use asm.dlang.orgd.godbolt.org (note .org not .com) works fine and will be updated to the
Apr 29 2015
On Wednesday, 29 April 2015 at 07:49:34 UTC, Iain Buclaw wrote:On 29 Apr 2015 09:05, "John Colvin via Digitalmars-d" < digitalmars-d puremagic.com> wrote:Did you check the dropdown menu? There's 4.9 in there. Hopefully the latest release from gdcproject.org will be added in the next couple of daysOn Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:the first version.On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:Trying on d.godbolt.com it seems a lot of extra-code is generated forlatest GDC shortly. asm.dlang.org only has DMD. Well it's using frontend 2.055, which I guess would put it at gdc-4.6 in Debian repos.d.godbolt.com is dead, use asm.dlang.orgd.godbolt.org (note .org not .com) works fine and will be updated to the
Apr 29 2015
On 29 April 2015 at 12:16, John Colvin via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Wednesday, 29 April 2015 at 07:49:34 UTC, Iain Buclaw wrote:Ah! I was on my phone and didn't notice. :-OOn 29 Apr 2015 09:05, "John Colvin via Digitalmars-d" < digitalmars-d puremagic.com> wrote:Did you check the dropdown menu? There's 4.9 in there. Hopefully the latest release from gdcproject.org will be added in the next couple of daysOn Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:the first version.On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:Trying on d.godbolt.com it seems a lot of extra-code is generated forlatest GDC shortly. asm.dlang.org only has DMD. Well it's using frontend 2.055, which I guess would put it at gdc-4.6 in Debian repos.d.godbolt.com is dead, use asm.dlang.orgd.godbolt.org (note .org not .com) works fine and will be updated to the
Apr 29 2015
On Wednesday, 29 April 2015 at 07:00:15 UTC, John Colvin wrote:On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:Ah, my bad! I know Iain was involved so I thought it had GDC as well :)On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 29 2015
On 29 April 2015 at 14:07, Vladimir Panteleev via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Wednesday, 29 April 2015 at 07:00:15 UTC, John Colvin wrote:DMD and GDC don't generate compatible outputs, so it's not that straightforward to have both together. ;-) d.godbolt.org is better than asm.dlang.org because GDC emits assembly, you have more information to play around with (and syntax highlighting works thanks to .file and .loc assembler directives). asm.dlang.org is a basterdised version that removes all features because DMD emits object code, and there is no useful information you can pull from objdump. It is nice that you can test the latest daily on asm.dlang.org though... Iain.On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:Ah, my bad! I know Iain was involved so I thought it had GDC as well :)On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 29 2015
On Wednesday, 29 April 2015 at 12:07:58 UTC, Vladimir Panteleev wrote:On Wednesday, 29 April 2015 at 07:00:15 UTC, John Colvin wrote:d.godbolt.org now has the latest release as default.On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:Ah, my bad! I know Iain was involved so I thought it had GDC as well :)On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 29 2015
On 29 April 2015 at 14:50, John Colvin via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Wednesday, 29 April 2015 at 12:07:58 UTC, Vladimir Panteleev wrote:I take it you've been speaking to the site maintainer? :o) Looks like he downloaded the binary off gdcproject.org?On Wednesday, 29 April 2015 at 07:00:15 UTC, John Colvin wrote:d.godbolt.org now has the latest release as default.On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:Ah, my bad! I know Iain was involved so I thought it had GDC as well :)On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 29 2015
On Wednesday, 29 April 2015 at 14:18:49 UTC, Iain Buclaw wrote:On 29 April 2015 at 14:50, John Colvin via Digitalmars-d <digitalmars-d puremagic.com> wrote:Yes and yes.On Wednesday, 29 April 2015 at 12:07:58 UTC, Vladimir Panteleev wrote:I take it you've been speaking to the site maintainer? :o) Looks like he downloaded the binary off gdcproject.org?On Wednesday, 29 April 2015 at 07:00:15 UTC, John Colvin wrote:d.godbolt.org now has the latest release as default.On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:Ah, my bad! I know Iain was involved so I thought it had GDC as well :)On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 30 2015
On 30 April 2015 at 15:01, John Colvin via Digitalmars-d <digitalmars-d puremagic.com> wrote:On Wednesday, 29 April 2015 at 14:18:49 UTC, Iain Buclaw wrote:You could have waited a month for gdc-5 to come out of experimental... https://packages.debian.org/experimental/gdc-5On 29 April 2015 at 14:50, John Colvin via Digitalmars-d <digitalmars-d puremagic.com> wrote:Yes and yes.On Wednesday, 29 April 2015 at 12:07:58 UTC, Vladimir Panteleev wrote:I take it you've been speaking to the site maintainer? :o) Looks like he downloaded the binary off gdcproject.org?On Wednesday, 29 April 2015 at 07:00:15 UTC, John Colvin wrote:d.godbolt.org now has the latest release as default.On Tuesday, 28 April 2015 at 21:19:53 UTC, Vladimir Panteleev wrote:Ah, my bad! I know Iain was involved so I thought it had GDC as well :)On Tuesday, 28 April 2015 at 10:24:27 UTC, Andrea Fontana wrote:d.godbolt.org (note .org not .com) works fine and will be updated to the latest GDC shortly. asm.dlang.org only has DMD.Trying on d.godbolt.com it seems a lot of extra-code is generated for the first version.d.godbolt.com is dead, use asm.dlang.org
Apr 30 2015
On Tuesday, 28 April 2015 at 10:07:43 UTC, Andrea Fontana wrote:On Tuesday, 28 April 2015 at 09:23:53 UTC, Chris wrote:Using std.functional: "test".toUpper.unaryFun!(a => "This is a " ~ a).writeln;And this has happened to me many times. The solution "Break the UFCS chain and use a local temporary variable" makes me angry, because by having to do so all the beauty of chaining is lost.A very slow (i guess) workaround could be: "test".toUpper.only.map!(a => "This is a " ~ a).front.writeln; vs the new one: "test".toUpper.Identity!(a => "This is a " ~ a).writeln;
Apr 28 2015
On Tuesday, 28 April 2015 at 02:36:38 UTC, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Very nice. There is also a similar package protected template in std.typetuple, `Alias`. I used it a lot but last applicability case with UFCS chain didn't come to my mind. It looks very elegant. I had plans to introduce it as a public helper in std.meta under the name `Symbol`, would that make sense?
Apr 28 2015
On 4/27/15 7:36 PM, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Went to post on reddit, was there already: http://www.reddit.com/r/programming/comments/345zw3/the_amazing_template_that_does_nothing/ I've also posted on these other sites: https://news.ycombinator.com/newest https://twitter.com/D_Programming/status/593135475537223680 https://www.facebook.com/dlang.org/posts/1059305784083102 Andrei
Apr 28 2015
On Tuesday, 28 April 2015 at 19:32:40 UTC, Andrei Alexandrescu wrote:On 4/27/15 7:36 PM, Vladimir Panteleev wrote:Thank you, though the article is kinda targeted at experienced D developers. As the redditors have been quick to point out, most of these are basically workarounds for grammar quirks.http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Went to post on reddit, was there already: http://www.reddit.com/r/programming/comments/345zw3/the_amazing_template_that_does_nothing/ I've also posted on these other sites:
Apr 28 2015
On 4/27/15 10:36 PM, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Very cool. Just a grammar nit, "an UFCS" should be "a UFCS". -Steve
Apr 28 2015
On Tuesday, 28 April 2015 at 21:42:04 UTC, Steven Schveighoffer wrote:On 4/27/15 10:36 PM, Vladimir Panteleev wrote:Fixed, thanks. (I always found this rule counter-intuitive... "u" is a vowel dangit!)http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Very cool. Just a grammar nit, "an UFCS" should be "a UFCS".
Apr 28 2015
On 4/28/15 6:00 PM, Vladimir Panteleev wrote:On Tuesday, 28 April 2015 at 21:42:04 UTC, Steven Schveighoffer wrote:And in most cases, 'an' is correct. It's only when it makes a "you" sound (and if you spell out your acronyms, 'U' does), when you want to use 'a' :) an upsetting rule ('uh') an uber-cool language ('oo') a unique grammar problem ('you') -SteveOn 4/27/15 10:36 PM, Vladimir Panteleev wrote:Fixed, thanks. (I always found this rule counter-intuitive... "u" is a vowel dangit!)http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Very cool. Just a grammar nit, "an UFCS" should be "a UFCS".
Apr 28 2015
On Tuesday, 28 April 2015 at 22:29:40 UTC, Steven Schveighoffer wrote:On 4/28/15 6:00 PM, Vladimir Panteleev wrote:Yeah, because the sound in `you` or the letter <u> is not a full vowel but a semi-vowel /j/ (cf. German `ja`), also: a "voiced palatal approximant": https://en.wikipedia.org/wiki/Palatal_approximant Whenever a phonetic /u(:)/ becomes a /ju(:)/ (for whatever reason), rules for vowels no longer apply, simply because it is (phonetically speaking) no longer vowel, e.g. an + V => a + /j/. Cf a utilitarian point of view (*an utilitarian) /juː/ The spelling rule upsets you, because there is a mismatch between what you see on the page and how you pronounce it (vowel vs. consonant/semi-vowel). It also works the other way around: - an STL expert - a PhD student <s> describes a consonant but is pronounced with a vowel here /es/. Thus, you have to write `an`. Just follow your natural way of speaking and you'll be fine. Read it out to yourself. And let's be honest, it sounds really crap when you read "an UFCS", bahhh!On Tuesday, 28 April 2015 at 21:42:04 UTC, Steven Schveighoffer wrote:And in most cases, 'an' is correct. It's only when it makes a "you" sound (and if you spell out your acronyms, 'U' does), when you want to use 'a' :) an upsetting rule ('uh') an uber-cool language ('oo') a unique grammar problem ('you') -SteveOn 4/27/15 10:36 PM, Vladimir Panteleev wrote:Fixed, thanks. (I always found this rule counter-intuitive... "u" is a vowel dangit!)http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Very cool. Just a grammar nit, "an UFCS" should be "a UFCS".
Apr 29 2015
On Wednesday, 29 April 2015 at 09:44:27 UTC, Chris wrote:Just follow your natural way of speaking and you'll be fine. Read it out to yourself. And let's be honest, it sounds really crap when you read "an UFCS", bahhh!Yes, well, the problem is that "an U" sounds completely fine in my head! The way you pronounce the U letter in the English alphabet is the same (not sure if identical) as the Russian letter Ю, which is considered a vowel in Russian.
Apr 29 2015
On Wednesday, 29 April 2015 at 09:57:01 UTC, Vladimir Panteleev wrote:On Wednesday, 29 April 2015 at 09:44:27 UTC, Chris wrote:In that case you'll just have to learn the rule: if it's a single letter, it has to be `an`. Sorry, I didn't realize that /j/ is treated as a vowel in Russian. I was thinking of languages I'm familiar with, and there /j/ is always treated as a consonant. Is the Russian sound a fricative or a pure vowel without any friction (= obstruction)?Just follow your natural way of speaking and you'll be fine. Read it out to yourself. And let's be honest, it sounds really crap when you read "an UFCS", bahhh!Yes, well, the problem is that "an U" sounds completely fine in my head! The way you pronounce the U letter in the English alphabet is the same (not sure if identical) as the Russian letter Ю, which is considered a vowel in Russian.
Apr 29 2015
On Wednesday, 29 April 2015 at 10:09:39 UTC, Chris wrote:On Wednesday, 29 April 2015 at 09:57:01 UTC, Vladimir Panteleev wrote:Can't answer that question, but <Ю> is actually [ju] in isolation, that is, a glide + a vowel. When preceded by a consonant, that glide is not pronounced, instead the consonant gets palatalized. Thus it would be better to say that /ju/ is treated as a vowel, not /j/.On Wednesday, 29 April 2015 at 09:44:27 UTC, Chris wrote:In that case you'll just have to learn the rule: if it's a single letter, it has to be `an`. Sorry, I didn't realize that /j/ is treated as a vowel in Russian. I was thinking of languages I'm familiar with, and there /j/ is always treated as a consonant. Is the Russian sound a fricative or a pure vowel without any friction (= obstruction)?Just follow your natural way of speaking and you'll be fine. Read it out to yourself. And let's be honest, it sounds really crap when you read "an UFCS", bahhh!Yes, well, the problem is that "an U" sounds completely fine in my head! The way you pronounce the U letter in the English alphabet is the same (not sure if identical) as the Russian letter Ю, which is considered a vowel in Russian.
Apr 29 2015
On Wednesday, 29 April 2015 at 10:15:52 UTC, Marc Schütz wrote:On Wednesday, 29 April 2015 at 10:09:39 UTC, Chris wrote:Hm, a glide is not necessarily a fricative. In English the /j/ sometimes comes close to /ç/, as in German `ich`. A glide would be more like /ɪu/, however, in this environment glides tend to have some sort of friction, it's almost unavoidable. Interesting, though, how the same sounds are perceived differently in different languages.On Wednesday, 29 April 2015 at 09:57:01 UTC, Vladimir Panteleev wrote:Can't answer that question, but <Ю> is actually [ju] in isolation, that is, a glide + a vowel. When preceded by a consonant, that glide is not pronounced, instead the consonant gets palatalized. Thus it would be better to say that /ju/ is treated as a vowel, not /j/.On Wednesday, 29 April 2015 at 09:44:27 UTC, Chris wrote:In that case you'll just have to learn the rule: if it's a single letter, it has to be `an`. Sorry, I didn't realize that /j/ is treated as a vowel in Russian. I was thinking of languages I'm familiar with, and there /j/ is always treated as a consonant. Is the Russian sound a fricative or a pure vowel without any friction (= obstruction)?Just follow your natural way of speaking and you'll be fine. Read it out to yourself. And let's be honest, it sounds really crap when you read "an UFCS", bahhh!Yes, well, the problem is that "an U" sounds completely fine in my head! The way you pronounce the U letter in the English alphabet is the same (not sure if identical) as the Russian letter Ю, which is considered a vowel in Russian.
Apr 29 2015
On Tuesday, 28 April 2015 at 02:36:38 UTC, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/A truly polymorphic identity function in D would be more involved: template id(a...) if (a.length == 1) { static if (__traits(compiles, { alias id = a[0]; } )) alias id = a[0]; else enum id = a[0]; } static assert(is(id!int == int)); static assert(id!1 == 1); Also, an 'isEqual' template would be needed to unify 'isSame', 'is' and '=='.
Apr 28 2015
On Tuesday, 28 April 2015 at 22:24:53 UTC, Max Samukha wrote:On Tuesday, 28 April 2015 at 02:36:38 UTC, Vladimir Panteleev wrote:Actually I do find more specialized names/implementations useful in this case. For example, just the fact that you use `unaryFun!(a => a)` instead of `Identity!(a => a)` makes code more readable and intention clear even if effect is the same.http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/A truly polymorphic identity function in D would be more involved: template id(a...) if (a.length == 1) { static if (__traits(compiles, { alias id = a[0]; } )) alias id = a[0]; else enum id = a[0]; } static assert(is(id!int == int)); static assert(id!1 == 1); Also, an 'isEqual' template would be needed to unify 'isSame', 'is' and '=='.
Apr 28 2015
On Tuesday, 28 April 2015 at 02:36:38 UTC, Vladimir Panteleev wrote:http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Thanks for good article little mistake: return from void function: /// Search a website for something, and parse the /// first search result's webpage. void getItemInfo(string itemName) { // Let's go! First, construct the URL. return ("http://www.example.com/search?q=" ~ encodeComponent(itemName)) .......
Apr 28 2015
On Wednesday, 29 April 2015 at 06:56:37 UTC, Nikolay wrote:On Tuesday, 28 April 2015 at 02:36:38 UTC, Vladimir Panteleev wrote:Fixed, thanks. Though, you technically still can use "return expression" in a void function, as long as expression's type is void :)http://blog.thecybershadow.net/2015/04/28/the-amazing-template-which-does-nothing/Thanks for good article little mistake: return from void function: /// Search a website for something, and parse the /// first search result's webpage. void getItemInfo(string itemName) { // Let's go! First, construct the URL. return ("http://www.example.com/search?q=" ~ encodeComponent(itemName)) .......
Apr 29 2015