Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: a style question: |
| Date | 2015-08-31 15:50 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <87twrftsuw.fsf@bsb.me.uk> (permalink) |
| References | <8d16838c-60db-4fd2-b401-737ee2601d1d@googlegroups.com> <6e9323cb-1dff-4bff-b19a-d4b1da735ffb@googlegroups.com> <ms1bf1$peo$1@dont-email.me> <87zj17tzq5.fsf@bsb.me.uk> <ms1m9d$3rs$1@dont-email.me> |
Bartc <bc@freeuk.com> writes: > On 31/08/2015 13:21, Ben Bacarisse wrote: >> Bartc <bc@freeuk.com> writes: >>> On 31/08/2015 11:24, Malcolm McLean wrote: > >>>> Usr::Graphics::BezierPathSimple<Math::real64_t, GREEN> >>> >>> Those guys really like to spell things out don't they? >> >> Well, yes. When technical things are being specified that are usually >> spelled out in quite a technical way. >> >> But Usr::Graphics::BezierPathSimple and Math::real_64_t are just a names >> that use name spaces to avoid clashes. What do you do to solve that >> problem? > > (1) Use a shorter alias for long-winded qualifiers That was Malcolm's choice. > (2) Use name-space defaults Ditto (unless you are suggesting that some user namespace should be an automatic default). > (3) *Don't* require "Math::" for primitive types! (A shorter name than > "real_64_t" wouldn't go amiss either. What on earth is wrong with > "real" or "real64"?) C++ does not require "Math::" for primitive types. It was Malcolm's choice to invent that type so everyone could clutch at their pearls in horror. In short, you agree with the way C++ is designed in these respects -- you just don't like how Malcolm wrote the (admittedly hypothetical) example. >> And the whole thing is the instantiation of a generic type >> with two parameters. > > Yes, now that you say it. When you stripped out all the extraneous > stuff, it was Name<real, GREEN>; that looked like a template, yet not > a template definition. > >> I.e. what is, in your view, the proper way to write that? > > I like using keywords to specify exactly what is being done. Perhaps > not as long-winded as this, but along these lines: > > define template ...... > instantiate template .... > > Then there is no excuse for not knowing what is happening. (Better > than trying to infer what is being done from a mess of punctuation and > syntax.) But you did not show an equivalent, so of course you can imply that it can be simpler. Show, in your language, the instantiation of a generic type with two parameters -- one a non-standard real type and the other a constant value. The simplest syntax is likely to be very similar to C++, but do show how much better you can make it. >> How do you do that in your private language? > > In my compiled language, I don't have templates. If I did, I would > make it more obvious, trust me. Or more likely I would put them into a > customisation sub-language that most people wouldn't have to read, or > be tempted to write, because I don't think this stuff belongs in > every-day code. > > While my dynamic language doesn't have templates; it doesn't really > need them as you effectively get generics for free. No, you get them at a price, but you don't show the code, so I have no idea what the price is. It may be that the type can't even be specified. I can't tell yet. >>> But yet, you say this is something returned by a function. So I don't >>> know what the hell it might be. What a language! >> >> The fact that you don't know what something is at first glance is an odd >> criterion to use. I can imagine people looking at >> >> PAR (DO n PLUSAB 1; start siever (first, n) OD, sieve (first)) >> or >> (^^) :: (Fractional a, Integral b) => a -> b -> a >> >> and saying "What a language!". Could it simply be that some things are >> complicated to specify, and that making it transparent at first glace >> might be counter-productive in the long run? > > Neither of these are as offensive to me as typical C++ code is. Yes, I know that. I'm just pointing out how odd that criterion is in such a technical field. <snip> -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
a style question: G G <gdotone@gmail.com> - 2015-08-31 02:30 -0700
Re: a style question: Ian Collins <ian-news@hotmail.com> - 2015-08-31 21:40 +1200
Re: a style question: jt@toerring.de (Jens Thoms Toerring) - 2015-08-31 09:52 +0000
Re: a style question: Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-31 03:24 -0700
Re: a style question: Bartc <bc@freeuk.com> - 2015-08-31 11:50 +0100
Re: a style question: Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-31 13:21 +0100
Re: a style question: Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-31 05:41 -0700
Re: a style question: Bartc <bc@freeuk.com> - 2015-08-31 14:55 +0100
Re: a style question: Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-08-31 15:50 +0100
Re: a style question: Bartc <bc@freeuk.com> - 2015-08-31 18:40 +0100
Re: a style question: Melzzzzz <mel@zzzzz.com> - 2015-08-31 17:46 +0200
Re: a style question: Bartc <bc@freeuk.com> - 2015-08-31 17:27 +0100
Re: a style question: Melzzzzz <mel@zzzzz.com> - 2015-08-31 18:42 +0200
Re: a style question: Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-08-31 17:41 +0000
Re: a style question: Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-31 15:33 -0700
Re: a style question: Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-01 08:34 +0000
Re: a style question: Ian Collins <ian-news@hotmail.com> - 2015-09-01 07:40 +1200
Re: a style question: Bartc <bc@freeuk.com> - 2015-08-31 21:36 +0100
Re: a style question: Ian Collins <ian-news@hotmail.com> - 2015-09-01 08:51 +1200
Re: a style question: Bartc <bc@freeuk.com> - 2015-08-31 22:37 +0100
Re: a style question: Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-31 15:24 -0700
Re: a style question: Ian Collins <ian-news@hotmail.com> - 2015-09-02 19:37 +1200
Re: a style question: jt@toerring.de (Jens Thoms Toerring) - 2015-08-31 23:33 +0000
Re: a style question: Bartc <bc@freeuk.com> - 2015-09-01 01:13 +0100
Re: a style question: Ian Collins <ian-news@hotmail.com> - 2015-09-01 18:21 +1200
Re: a style question: jt@toerring.de (Jens Thoms Toerring) - 2015-09-01 15:23 +0000
Re: a style question: Bartc <bc@freeuk.com> - 2015-09-01 18:06 +0100
Re: a style question: Jorgen Grahn <grahn+nntp@snipabacken.se> - 2015-09-01 20:39 +0000
Re: a style question: jt@toerring.de (Jens Thoms Toerring) - 2015-09-01 20:45 +0000
Re: a style question: Bartc <bc@freeuk.com> - 2015-09-01 22:53 +0100
Re: a style question: Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-08-31 17:51 -0700
csiph-web