digitalmars.D - Targeting C
- Tim Matthews (13/13) Oct 21 2009 While C may be not much from assembly and C++ a mess. C with a strapped
- bearophile (26/27) Oct 22 2009 Type of arguments can be stated once:
- =?ISO-8859-1?Q?Pelle_M=E5nsson?= (4/41) Oct 22 2009 Personally, I like this:
- bearophile (6/9) Oct 22 2009 While I like this more:
- Chris Nicholson-Sauls (14/26) Oct 23 2009 I prefer this (Scala):
- bearophile (5/7) Oct 23 2009 That's quite less readable. Scala sometimes has some unreadable syntax. ...
- Yigal Chripun (3/10) Oct 23 2009 how about this hypothetical syntax:
- Andrei Alexandrescu (5/22) Oct 23 2009 I'm not sure what the type of "list" is supposed to be, but this works
- Bill Baxter (12/35) Oct 23 2009 While we're not on the subject....
- Yigal Chripun (8/45) Oct 23 2009 Ranges are already part of the compiler because of foreach, can we also
- bearophile (5/7) Oct 23 2009 In both iota and other possible implementations I'd like the arguments u...
- Yigal Chripun (9/20) Oct 23 2009 Hell no. This is why I hate certain programming languages.
- bearophile (4/7) Oct 23 2009 Don't be silly. In my dlibs "xsomething" are the lazy functions, and "so...
- =?ISO-8859-1?Q?Pelle_M=E5nsson?= (5/15) Oct 23 2009 I think the complaint was not as much about the x as the iota.
- Andrei Alexandrescu (3/21) Oct 23 2009 Orthogonality for the win.
- Leandro Lucarella (10/32) Oct 23 2009 Sometimes "practicality beats purity" :)
- Yigal Chripun (10/27) Oct 23 2009 first thing xsomthing *is* silly and I agree with andrei and pelle about...
- =?ISO-8859-1?Q?=22J=E9r=F4me_M=2E_Berger=22?= (20/47) Oct 23 2009 =20
- Leandro Lucarella (10/21) Oct 23 2009 Thanks for mention this, now I don't feel *that* idiotic to have to go a...
- Andrei Alexandrescu (10/42) Oct 23 2009 Given that "range" is already taken, what name do you think would work b...
- Leandro Lucarella (13/56) Oct 23 2009 I don't see "range" taken inside the range module. I think it even makes
- =?UTF-8?B?UGVsbGUgTcOlbnNzb24=?= (3/50) Oct 23 2009 This was my thought as well.
- =?ISO-8859-1?Q?Pelle_M=E5nsson?= (2/28) Oct 23 2009 What does iota mean?
- Max Samukha (3/31) Oct 23 2009 A sequence of integral numbers. I guess the name comes from APL.
- Andrei Alexandrescu (4/32) Oct 23 2009 http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota
- Steven Schveighoffer (8/11) Oct 23 2009 Hm... this is slightly off topic, but that function signature is
- Andrei Alexandrescu (6/20) Oct 23 2009 I wanted to use auto, but ddoc cannot document functions with auto retur...
- Ary Borenszweig (7/24) Oct 23 2009 Is it too hard to fix that? I think ddoc works before the semantic pass
- Brad Roberts (12/39) Oct 23 2009 It'd be really sweet if someone stepped up to work on ddoc with the same...
- Max Samukha (12/17) Oct 24 2009 When I need to hack around an 'auto' bug, I sometimes factor out the
- Andrei Alexandrescu (5/30) Oct 24 2009 Well not just yet. I had to remove a wad of text that was dedicated to
- grauzone (9/40) Oct 23 2009 This link jumps straight to:
- Andrei Alexandrescu (4/47) Oct 23 2009 Well what was I supposed to do? It was either define another type Iota,
- rmcguire (7/57) Oct 30 2009 Hi Andrei,
- Andrei Alexandrescu (19/76) Oct 30 2009 Take!(
- Denis Koroskin (12/71) Oct 30 2009 is =
- =?ISO-8859-1?Q?=22J=E9r=F4me_M=2E_Berger=22?= (10/38) Oct 23 2009 =20
While C may be not much from assembly and C++ a mess. C with a strapped on GC can have full power, portability which just leaves the programmer to please. Some of spotted this and instead of compiling directly, they output C code. Some examples of this are: Bitc. Combines the flexibility, rich, safe of modern day functional languages with power of C. http://www.bitc-lang.org/ code using the GObject library. http://live.gnome.org/Vala And 2 more recent ones: OOC. I quite like how this one myself personally. http://ooc-lang.org/about Zimbu. Quote from the zimbu page: "It has to run on most systems, anything with a C compiler, so D is out" http://www.zimbu.org/
Oct 21 2009
Tim Matthews:OOC. I quite like how this one myself personally. http://ooc-lang.org/aboutType of arguments can be stated once: Vector3f: class { x, y, z : Float init: func(x, y, z : Float) { this x = x // 'this' is called 'self' in some other languages this y = y this z = z } } It doesn't need the is() when you test for type equality: print: func <T> (arg: T) { if(T == Int) { printf("%d\n", arg as Int) // 'as' allow casting } else if(T == String) { printf("%s\n", arg as String) } } Uses a syntax better than the D foreach: list := ArrayList<Int> new() for(i in 0..10) list add(i) // oh yeah no needs for brackets for(i in list) printf("%d\n") And I have omitted some other handy features. There's something to learn for D too :-) Bye, bearophile
Oct 22 2009
bearophile wrote:Tim Matthews:Personally, I like this: foreach (i; 0..10) list ~= i; more. :)OOC. I quite like how this one myself personally. http://ooc-lang.org/aboutType of arguments can be stated once: Vector3f: class { x, y, z : Float init: func(x, y, z : Float) { this x = x // 'this' is called 'self' in some other languages this y = y this z = z } } It doesn't need the is() when you test for type equality: print: func <T> (arg: T) { if(T == Int) { printf("%d\n", arg as Int) // 'as' allow casting } else if(T == String) { printf("%s\n", arg as String) } } Uses a syntax better than the D foreach: list := ArrayList<Int> new() for(i in 0..10) list add(i) // oh yeah no needs for brackets for(i in list) printf("%d\n") And I have omitted some other handy features. There's something to learn for D too :-) Bye, bearophile
Oct 22 2009
Pelle Månsson:Personally, I like this: foreach (i; 0..10) list ~= i; more. :)While I like this more: for (i in 0 .. 10) list ~= i; Bye, bearophile
Oct 22 2009
bearophile wrote:Pelle Månsson:I prefer this (Scala): list = list ++ (0 to 10) Okay, that's not really fair. The direct port to Scala would be more like: for { i <- 0 to 10 } list :::= List(i) Ultimately, syntax only really matters greatly where it provides some significant advantage or detours from some significant disadvantage. Kinda like the '$' in array indices. Early on in D, we had no such creature, but I threw my support fully behind it because of my prior experience with ColdC (and λμ, etc) and its use of the same syntax. Generally speaking, when a given language has an inordinate amount of syntax in some activity, it is probably a good sign that activity is uncommon when the language is properly applied. Conversely, a terse compact syntax is a good sign that's common usage. Depends on "genre"... and now I'm ranting and have no idea why. -- Chris Nicholson-SaulsPersonally, I like this: foreach (i; 0..10) list ~= i; more. :)While I like this more: for (i in 0 .. 10) list ~= i; Bye, bearophile
Oct 23 2009
Chris Nicholson-Sauls:I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
On 23/10/2009 13:02, bearophile wrote:Chris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Yigal Chripun wrote:On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
On Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Yigal Chripun wrote:While we're not on the subject.... "Iota" is right up there with "inSitu". I know it has a precedent elsewhere, but it sounds about as user friendly as monads. It just sounds like the language it trying to be snooty. Like "if you don't even know what iota is, you're clearly not qualified to join our little D club. Maybe you should try Java... or Logo". Compare that to Python where it's called "range", something every Joe the Programmer can certainly grok without having to get a Greek to English dictionary. --bbOn 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10));Chris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
On 23/10/2009 17:51, Bill Baxter wrote:On Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Ranges are already part of the compiler because of foreach, can we also add language support for Range literals? i.e (1..10) => range(1, 10) //(I'm using BB's much better name) [1..10] => array(range(1, 10)) it already is supported is foreach, isn't it? foreach (i; 1..10) {...}Yigal Chripun wrote:While we're not on the subject.... "Iota" is right up there with "inSitu". I know it has a precedent elsewhere, but it sounds about as user friendly as monads. It just sounds like the language it trying to be snooty. Like "if you don't even know what iota is, you're clearly not qualified to join our little D club. Maybe you should try Java... or Logo". Compare that to Python where it's called "range", something every Joe the Programmer can certainly grok without having to get a Greek to English dictionary. --bbOn 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10));Chris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Yigal Chripun:Ranges are already part of the compiler because of foreach, can we also add language support for Range literals?In both iota and other possible implementations I'd like the arguments used by Python range/xrange, they are optimal, and better than the currently ones used by iota. And being ranges lazy and eager (strict) so common, I may want both versions, so I don't need array(iota(...)) (all this is present in my dlibs). What about xiota for the lazy version? Or maybe aiota for the eager version? :-) Bye, bearophile
Oct 23 2009
On 23/10/2009 18:29, bearophile wrote:Yigal Chripun:Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names? names are important and they must be readable (in English. latin/greek/hindu/klingon/etc are not accepted). I don't care if I need to type ten letters instead of just five if later on I can understand immediately what the code does instead of spending half an hour reading the (outdated) documentation if I even bothered to write one.Ranges are already part of the compiler because of foreach, can we also add language support for Range literals?In both iota and other possible implementations I'd like the arguments used by Python range/xrange, they are optimal, and better than the currently ones used by iota. And being ranges lazy and eager (strict) so common, I may want both versions, so I don't need array(iota(...)) (all this is present in my dlibs). What about xiota for the lazy version? Or maybe aiota for the eager version? :-) Bye, bearophile
Oct 23 2009
Yigal Chripun:Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names?Don't be silly. In my dlibs "xsomething" are the lazy functions, and "something" are the strict ones. That's not obfuscated, you need seconds to learn a single easy rule. Bye, bearophile
Oct 23 2009
bearophile wrote:Yigal Chripun:I think the complaint was not as much about the x as the iota. Seriously, iota? However, I like the array(range(0,10)) where range is always lazy, and array forces eagerness, better than separate xrange and range functions.Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names?Don't be silly. In my dlibs "xsomething" are the lazy functions, and "something" are the strict ones. That's not obfuscated, you need seconds to learn a single easy rule. Bye, bearophile
Oct 23 2009
Pelle Månsson wrote:bearophile wrote:Orthogonality for the win. AndreiYigal Chripun:I think the complaint was not as much about the x as the iota. Seriously, iota? However, I like the array(range(0,10)) where range is always lazy, and array forces eagerness, better than separate xrange and range functions.Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names?Don't be silly. In my dlibs "xsomething" are the lazy functions, and "something" are the strict ones. That's not obfuscated, you need seconds to learn a single easy rule. Bye, bearophile
Oct 23 2009
Andrei Alexandrescu, el 23 de octubre a las 13:06 me escribiste:Pelle Månsson wrote:Sometimes "practicality beats purity" :) But I don't really care that much about this one... -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- DIEZ "PUNGAS" MENOS -- Crónica TVbearophile wrote:Orthogonality for the win.Yigal Chripun:I think the complaint was not as much about the x as the iota. Seriously, iota? However, I like the array(range(0,10)) where range is always lazy, and array forces eagerness, better than separate xrange and range functions.Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names?Don't be silly. In my dlibs "xsomething" are the lazy functions, and "something" are the strict ones. That's not obfuscated, you need seconds to learn a single easy rule. Bye, bearophile
Oct 23 2009
On 23/10/2009 19:49, Pelle Månsson wrote:bearophile wrote:first thing xsomthing *is* silly and I agree with andrei and pelle about having an array function that forces eagerness. but more generally speaking, each individual part can be rationalized like xsomething is lazy, iota generates a lazy range, etc.. but combined you get meaningless letters.. xaiota? rule 1 of programming - code is read 1000 times more then written. today at the age of terabyte HDDs writing strcmp instead of string_compare or stringCompare (depends on your love for camels) is absolutely ridiculous.Yigal Chripun:I think the complaint was not as much about the x as the iota. Seriously, iota? However, I like the array(range(0,10)) where range is always lazy, and array forces eagerness, better than separate xrange and range functions.Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names?Don't be silly. In my dlibs "xsomething" are the lazy functions, and "something" are the strict ones. That's not obfuscated, you need seconds to learn a single easy rule. Bye, bearophile
Oct 23 2009
Yigal Chripun wrote:On 23/10/2009 18:29, bearophile wrote:=20Yigal Chripun:=20 =20 Hell no. This is why I hate certain programming languages. if you are trying to obfuscate the language than why not just define: rtqfrdsg and fdkjtkf as the function names? =20 names are important and they must be readable (in English.=20 latin/greek/hindu/klingon/etc are not accepted). I don't care if I need=Ranges are already part of the compiler because of foreach, can we also add language support for Range literals?In both iota and other possible implementations I'd like the arguments used by Python range/xrange, they are optimal, and better than the currently ones used by iota. And being ranges lazy and eager (strict) so common, I may want both versions, so I don't need array(iota(...)) (all this is present in my dlibs). What about xiota for the lazy version? Or maybe aiota for the eager version? :-) Bye, bearophileto type ten letters instead of just five if later on I can understand=20 immediately what the code does instead of spending half an hour reading==20the (outdated) documentation if I even bothered to write one.Note that both "iota" and "in situ" are in the "Collins Cobuild=20 English Language Dictionary". Here are their definitions: "in situ" is used to describe something that remains in its original=20 or appropriate place while work is done on it. "iota" An iota of something is an extremely small amount of it. Therefore, both should be considered acceptable English words.=20 However whereas "inSitu" says exactly what it means, I'm not so sure=20 about "iota" Jerome PS: For those who don't know, the Collins Cobuild is special in that=20 it is built using statistics on word usage. They choose which words=20 to include based on how frequently those words are used in common=20 English. --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Oct 23 2009
Bill Baxter, el 23 de octubre a las 08:51 me escribiste:Thanks for mention this, now I don't feel *that* idiotic to have to go and search what iota means every time I see it =) -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- Did you know the originally a Danish guy invented the burglar-alarm unfortunately, it got stolenlist ~= array(iota(0, 10));While we're not on the subject.... "Iota" is right up there with "inSitu". I know it has a precedent elsewhere, but it sounds about as user friendly as monads. It just sounds like the language it trying to be snooty. Like "if you don't even know what iota is, you're clearly not qualified to join our little D club. Maybe you should try Java... or Logo". Compare that to Python where it's called "range", something every Joe the Programmer can certainly grok without having to get a Greek to English dictionary.
Oct 23 2009
Bill Baxter wrote:On Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Given that "range" is already taken, what name do you think would work best? (I sometimes deliberately prefer less-used names because the more used ones often come with baggage and ambiguities (as is the case with "range"). Case in point, "in-situ" is more informative than "in-place" because the former suggests emplacement of a substructure within a larger structure. So to me an "in-situ" class member inside a class has a clear meaning that the member sits right there within the class. But anyhow I will use in-place from now on.) AndreiYigal Chripun wrote:While we're not on the subject.... "Iota" is right up there with "inSitu". I know it has a precedent elsewhere, but it sounds about as user friendly as monads. It just sounds like the language it trying to be snooty. Like "if you don't even know what iota is, you're clearly not qualified to join our little D club. Maybe you should try Java... or Logo". Compare that to Python where it's called "range", something every Joe the Programmer can certainly grok without having to get a Greek to English dictionary.On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10));Chris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Andrei Alexandrescu, el 23 de octubre a las 11:09 me escribiste:Bill Baxter wrote:I don't see "range" taken inside the range module. I think it even makes sense, iota() is the more primitive range ever, so why don't just call it range()? :) Anyway, I think it makes perfect sense to have the compiler translating x..y to a iota/range(x, y). -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- CAROZO CON FARINGITIS -- Crónica TVOn Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Given that "range" is already taken, what name do you think would work best? (I sometimes deliberately prefer less-used names because the more used ones often come with baggage and ambiguities (as is the case with "range"). Case in point, "in-situ" is more informative than "in-place" because the former suggests emplacement of a substructure within a larger structure. So to me an "in-situ" class member inside a class has a clear meaning that the member sits right there within the class. But anyhow I will use in-place from now on.)Yigal Chripun wrote:While we're not on the subject.... "Iota" is right up there with "inSitu". I know it has a precedent elsewhere, but it sounds about as user friendly as monads. It just sounds like the language it trying to be snooty. Like "if you don't even know what iota is, you're clearly not qualified to join our little D club. Maybe you should try Java... or Logo". Compare that to Python where it's called "range", something every Joe the Programmer can certainly grok without having to get a Greek to English dictionary.On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10));Chris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Leandro Lucarella wrote:Andrei Alexandrescu, el 23 de octubre a las 11:09 me escribiste:This was my thought as well. I don't know if it fares well in the ambiguity department, though.Bill Baxter wrote:I don't see "range" taken inside the range module. I think it even makes sense, iota() is the more primitive range ever, so why don't just call it range()? :)On Fri, Oct 23, 2009 at 5:13 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Given that "range" is already taken, what name do you think would work best? (I sometimes deliberately prefer less-used names because the more used ones often come with baggage and ambiguities (as is the case with "range"). Case in point, "in-situ" is more informative than "in-place" because the former suggests emplacement of a substructure within a larger structure. So to me an "in-situ" class member inside a class has a clear meaning that the member sits right there within the class. But anyhow I will use in-place from now on.)Yigal Chripun wrote:While we're not on the subject.... "Iota" is right up there with "inSitu". I know it has a precedent elsewhere, but it sounds about as user friendly as monads. It just sounds like the language it trying to be snooty. Like "if you don't even know what iota is, you're clearly not qualified to join our little D club. Maybe you should try Java... or Logo". Compare that to Python where it's called "range", something every Joe the Programmer can certainly grok without having to get a Greek to English dictionary.On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10));Chris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Andrei Alexandrescu wrote:Yigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
On Fri, 23 Oct 2009 18:16:29 +0200, Pelle M?nsson <pelle.mansson gmail.com> wrote:Andrei Alexandrescu wrote:A sequence of integral numbers. I guess the name comes from APL.Yigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Pelle Månsson wrote:Andrei Alexandrescu wrote:http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota Irony minded. I'm destroyed. AndreiYigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
On Fri, 23 Oct 2009 12:50:34 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Hm... this is slightly off topic, but that function signature is absolutely horrendous (in fact, I thought you linked to the wrong place at first). Isn't there any way to avoid putting half the type construction as the return value? Do all range-creating functions suffer from this problem? Maybe it's just a ddoc problem. -SteveWhat does iota mean?http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota Irony minded. I'm destroyed.
Oct 23 2009
Steven Schveighoffer wrote:On Fri, 23 Oct 2009 12:50:34 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I wanted to use auto, but ddoc cannot document functions with auto returns. Andrei P.S. It looks like TDPL will scream today through the 100,000 words barrier (at 97,781 words now, see and track at www.erdani.com). When that happens, I'll celebrate by making another excerpt available online.Hm... this is slightly off topic, but that function signature is absolutely horrendous (in fact, I thought you linked to the wrong place at first). Isn't there any way to avoid putting half the type construction as the return value? Do all range-creating functions suffer from this problem? Maybe it's just a ddoc problem.What does iota mean?http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota Irony minded. I'm destroyed.
Oct 23 2009
Andrei Alexandrescu wrote:Steven Schveighoffer wrote:Is it too hard to fix that? I think ddoc works before the semantic pass so the return type is null by then, but it isn't very hard to see a "if type.next != null" in the source code... I say it because I also find horrendous the signature. And what's more, it's hard to find the word "iota" there. I also think "iota" is an awful name for that function.On Fri, 23 Oct 2009 12:50:34 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I wanted to use auto, but ddoc cannot document functions with auto returns.Hm... this is slightly off topic, but that function signature is absolutely horrendous (in fact, I thought you linked to the wrong place at first). Isn't there any way to avoid putting half the type construction as the return value? Do all range-creating functions suffer from this problem? Maybe it's just a ddoc problem.What does iota mean?http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota Irony minded. I'm destroyed.
Oct 23 2009
On Fri, 23 Oct 2009, Ary Borenszweig wrote:Andrei Alexandrescu wrote:It'd be really sweet if someone stepped up to work on ddoc with the same gusto that Don has been on other parts of DMD. IMHO, without having done enough code study, ddoc should be split off into a separate executable that shared the first stages of DMD. I'm not sure that'd help it act different where it needs to act different, but it'd certainly be an interesting exercise to get more data about how re-usable parts of DMD are. Alternatively, it'd also be interesting to explore making it _really_ separate and use the new -X output and build docs completely off that. Later, BradSteven Schveighoffer wrote:Is it too hard to fix that? I think ddoc works before the semantic pass so the return type is null by then, but it isn't very hard to see a "if type.next != null" in the source code... I say it because I also find horrendous the signature. And what's more, it's hard to find the word "iota" there. I also think "iota" is an awful name for that function.On Fri, 23 Oct 2009 12:50:34 -0400, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I wanted to use auto, but ddoc cannot document functions with auto returns.Hm... this is slightly off topic, but that function signature is absolutely horrendous (in fact, I thought you linked to the wrong place at first). Isn't there any way to avoid putting half the type construction as the return value? Do all range-creating functions suffer from this problem? Maybe it's just a ddoc problem.What does iota mean?http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota Irony minded. I'm destroyed.
Oct 23 2009
On Fri, 23 Oct 2009 13:08:06 -0500, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I wanted to use auto, but ddoc cannot document functions with auto returns. AndreiWhen I need to hack around an 'auto' bug, I sometimes factor out the return type to a template: template IotaRet(B, E, S = size_t) { alias Take!(Sequence!("a.field[0] + n * a.field[1]", Tuple!(CommonType!(B, E), S))) IotaRet; } IotaRet!(B, E, S) iota(B, E, S)(B begin, E end, S step) {} IotaRet!(B, E) iota(B, E)(B begin, E end) {}P.S. It looks like TDPL will scream today through the 100,000 words barrier (at 97,781 words now, see and track at www.erdani.com). When that happens, I'll celebrate by making another excerpt available online.Congrats!
Oct 24 2009
Max Samukha wrote:On Fri, 23 Oct 2009 13:08:06 -0500, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I think I'll do that.I wanted to use auto, but ddoc cannot document functions with auto returns. AndreiWhen I need to hack around an 'auto' bug, I sometimes factor out the return type to a template: template IotaRet(B, E, S = size_t) { alias Take!(Sequence!("a.field[0] + n * a.field[1]", Tuple!(CommonType!(B, E), S))) IotaRet; } IotaRet!(B, E, S) iota(B, E, S)(B begin, E end, S step) {} IotaRet!(B, E) iota(B, E)(B begin, E end) {}Well not just yet. I had to remove a wad of text that was dedicated to T[new], so after a full day's work I'm only at 97,917 words. AndreiP.S. It looks like TDPL will scream today through the 100,000 words barrier (at 97,781 words now, see and track at www.erdani.com). When that happens, I'll celebrate by making another excerpt available online.Congrats!
Oct 24 2009
Andrei Alexandrescu wrote:Pelle Månsson wrote:This link jumps straight to: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) iota(B, E, S)(B begin, E end, S step); Wow, please tell me this is a ddoc malfunction. I mean, that thing left to iota is supposed to be a type? (OK, it _is_ a malfunction, but that thing is still supposed to be... a type?)Andrei Alexandrescu wrote:http://www.digitalmars.com/d/2.0/phobos/std_range.html#iotaYigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
grauzone wrote:Andrei Alexandrescu wrote:Well what was I supposed to do? It was either define another type Iota, or reuse existing types. I chose to reuse. AndreiPelle MÃ¥nsson wrote:This link jumps straight to: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) iota(B, E, S)(B begin, E end, S step); Wow, please tell me this is a ddoc malfunction. I mean, that thing left to iota is supposed to be a type? (OK, it _is_ a malfunction, but that thing is still supposed to be... a type?)Andrei Alexandrescu wrote:http://www.digitalmars.com/d/2.0/phobos/std_range.html#iotaYigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 23 2009
Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:grauzone wrote:Hi Andrei, Could you tell me why: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) Is a type and not a value? -RoryAndrei Alexandrescu wrote:Well what was I supposed to do? It was either define another type Iota, or reuse existing types. I chose to reuse. AndreiPelle Månsson wrote:This link jumps straight to: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) iota(B, E, S)(B begin, E end, S step); Wow, please tell me this is a ddoc malfunction. I mean, that thing left to iota is supposed to be a type? (OK, it _is_ a malfunction, but that thing is still supposed to be... a type?)Andrei Alexandrescu wrote:http://www.digitalmars.com/d/2.0/phobos/std_range.html#iotaYigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 30 2009
rmcguire wrote:Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Take!( Sequence!( "a.field[0] + n * a.field[1]", Tuple!( CommonType!(B,E), S ) ) ) If you look here: http://www.dsource.org/projects/phobos/browser/trunk/phobos/std/algorithm.d and in related files, you'll see that Take is a type with one parameter. Then Sequence is a type with two parameters. Then Tuple is a type with any number of parameters, and so is CommonType. So in spite of it looking complicated, it's just a usual instantiation of a few parameterized types. (What may confuse a C++ programmer is the presence of the string - it's just a template argument.) Andreigrauzone wrote:Hi Andrei, Could you tell me why: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) Is a type and not a value? -RoryAndrei Alexandrescu wrote:Well what was I supposed to do? It was either define another type Iota, or reuse existing types. I chose to reuse. AndreiPelle Månsson wrote:This link jumps straight to: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) iota(B, E, S)(B begin, E end, S step); Wow, please tell me this is a ddoc malfunction. I mean, that thing left to iota is supposed to be a type? (OK, it _is_ a malfunction, but that thing is still supposed to be... a type?)Andrei Alexandrescu wrote:http://www.digitalmars.com/d/2.0/phobos/std_range.html#iotaYigal Chripun wrote:What does iota mean?On 23/10/2009 13:02, bearophile wrote:I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~= array(iota(0, 10)); AndreiChris Nicholson-Sauls:how about this hypothetical syntax: list ~= [0..10];I prefer this (Scala): list = list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable syntax. Python has taught me how much useful a readable syntax is :-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophile
Oct 30 2009
On Fri, 30 Oct 2009 10:05:27 +0300, rmcguire <rjmcguire gmail.com> wrote= :Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:grauzone wrote:Andrei Alexandrescu wrote:Pelle M=C3=A5nsson wrote:Andrei Alexandrescu wrote:Yigal Chripun wrote:On 23/10/2009 13:02, bearophile wrote:Chris Nicholson-Sauls:I prefer this (Scala): list =3D list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable=is =syntax. Python has taught me how much useful a readable syntax =d, =This link jumps straight to: Take!(Sequence!("a.field[0] + n * a.field[1]",Tuple!(CommonType!(B,E),S))) iota(B, E, S)(B begin, E en=http://www.digitalmars.com/d/2.0/phobos/std_range.html#iotaWhat does iota mean?I'm not sure what the type of "list" is supposed to be, but this works today for arrays: list ~=3D array(iota(0, 10)); Andrei:-) Designing languages requires to find a balance between several different and opposed needs. Bye, bearophilehow about this hypothetical syntax: list ~=3D [0..10];eftS step); Wow, please tell me this is a ddoc malfunction. I mean, that thing l=. ato iota is supposed to be a type? (OK, it _is_ a malfunction, but that thing is still supposed to be..=a,type?)Well what was I supposed to do? It was either define another type Iot=or reuse existing types. I chose to reuse. AndreiHi Andrei, Could you tell me why: Take!(Sequence!("a.field[0] + n * =a.field[1]",Tuple!(CommonType!(B,E),S))) Is a type and not a value? -RoryI guess Take!(T) is a type, returned by a take(T t, int limit) function = = (it accepts a range and returns other range with a "limit" elements at = most). The naming is consistent with a function, but capitalized to = reflect that it's actually a type, not a function.
Oct 30 2009
Pelle M=E5nsson wrote:Andrei Alexandrescu wrote:)Yigal Chripun wrote:On 23/10/2009 13:02, bearophile wrote:Chris Nicholson-Sauls:I prefer this (Scala): list =3D list ++ (0 to 10)That's quite less readable. Scala sometimes has some unreadable=20 syntax. Python has taught me how much useful a readable syntax is :-==20I'm not sure what the type of "list" is supposed to be, but this works=Designing languages requires to find a balance between several=20 different and opposed needs. Bye, bearophilehow about this hypothetical syntax: list ~=3D [0..10];In English: "A very small amount". This helped didn't it? ;) The=20 others have already answered for the D meaning. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.frtoday for arrays: list ~=3D array(iota(0, 10)); AndreiWhat does iota mean?
Oct 23 2009