[go-nuts] why iota can't be assigned to variables?
. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wed, May 3, 2017 at 3:19 PM T L wrote: Why would you want to assign iota to a variable? What value should iota in such case have? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wednesday, May 3, 2017 at 9:28:28 PM UTC+8, Jan Mercl wrote: > > On Wed, May 3, 2017 at 3:19 PM T L > > wrote: > > Why would you want to assign iota to a variable? What value should iota in > such case have? > > The request is not essential, but any harm of it? > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wed, May 3, 2017 at 4:38 PM T L wrote: > The request is not essential, but any harm of it? How can anybody know that if nobody knows what it shall actually do and what will be the impact on the complexity of the specification and implementation? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wednesday, May 3, 2017 at 10:53:42 PM UTC+8, Jan Mercl wrote: > > On Wed, May 3, 2017 at 4:38 PM T L > > wrote: > > > The request is not essential, but any harm of it? > > How can anybody know that if nobody knows what it shall actually do and > what will be the impact on the complexity of the specification and > implementation? > The complexity is the same as iota in constant declarations. > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On 05/03/2017 10:38 AM, T L wrote: > > > On Wednesday, May 3, 2017 at 9:28:28 PM UTC+8, Jan Mercl wrote: > > On Wed, May 3, 2017 at 3:19 PM T L > > wrote: > > Why would you want to assign iota to a variable? What value should > iota in such case have? > > > The request is not essential, but any harm of it? > Can you show an example (some preferably some mocked up Go code) of how this can be useful? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wed, May 3, 2017 at 5:07 PM T L wrote: > The complexity is the same as iota in constant declarations. How can that be claimed when still nobody ever seen any specification of what var foo = iota shall do at all? The space of possible semantics is unbounded. The sane subspace seems to me to be of zero volume, but will you please just explain what you expect from assigning iota to a variable? Don't suppose telepathy exists, thank you ;-) -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wednesday, May 3, 2017 at 11:39:29 PM UTC+8, Jan Mercl wrote: > > On Wed, May 3, 2017 at 5:07 PM T L > > wrote: > > > The complexity is the same as iota in constant declarations. > > How can that be claimed when still nobody ever seen any specification of > what var foo = iota shall do at all? The space of possible semantics is > unbounded. The sane subspace seems to me to be of zero volume, but will you > please just explain what you expect from assigning iota to a variable? > Just like what expected for constants. var ( a = iota // a == 0 b = iota // b == 1 ) > > Don't suppose telepathy exists, thank you ;-) > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wed, May 3, 2017 at 6:00 PM T L wrote: > Just like what expected for constants. For constants it's expected to reuse the last iota expression when absent. Do you propose that var ( a = iota b ) will become valid and initialize a to 0 and b to 1? If so, is it valid and what shall happen when one writes var ( a = iota b s string d ) ? If it's not valid, why? -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Thursday, May 4, 2017 at 12:17:13 AM UTC+8, Jan Mercl wrote: > > On Wed, May 3, 2017 at 6:00 PM T L > > wrote: > > > Just like what expected for constants. > > For constants it's expected to reuse the last iota expression when absent. > Do you propose that > > var ( > a = iota > b > ) > > will become valid and initialize a to 0 and b to 1? > > If so, is it valid and what shall happen when one writes > > var ( > a = iota > b > s string > d > ) > > ? > The rule is same for constants: d is also string, as s. > > If it's not valid, why? > > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
but const ( a = iota b s string d ) is not a valid declaration. You can't say "the rule is the same for constants". Again: const-declarations and variable declarations are very different. You can not argue "it's the same"; it's not. On Wed, May 3, 2017 at 6:28 PM, T L wrote: > > > On Thursday, May 4, 2017 at 12:17:13 AM UTC+8, Jan Mercl wrote: >> >> On Wed, May 3, 2017 at 6:00 PM T L wrote: >> >> > Just like what expected for constants. >> >> For constants it's expected to reuse the last iota expression when >> absent. Do you propose that >> >> var ( >> a = iota >> b >> ) >> >> will become valid and initialize a to 0 and b to 1? >> >> If so, is it valid and what shall happen when one writes >> >> var ( >> a = iota >> b >> s string >> d >> ) >> >> ? >> > > The rule is same for constants: d is also string, as s. > > > >> >> If it's not valid, why? >> >> >> -- >> >> -j >> > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Thursday, May 4, 2017 at 12:46:47 AM UTC+8, Axel Wagner wrote: > > but > const ( > a = iota > b > s string > d > ) > is not a valid declaration. You can't say "the rule is the same for > constants". > For the same rule, I mean just copying the corresponding part from last line. Yes, declared constant must be assigned. This is an unrelated rule for this topic. > > Again: const-declarations and variable declarations are very different. > You can not argue "it's the same"; it's not. > > On Wed, May 3, 2017 at 6:28 PM, T L > > wrote: > >> >> >> On Thursday, May 4, 2017 at 12:17:13 AM UTC+8, Jan Mercl wrote: >>> >>> On Wed, May 3, 2017 at 6:00 PM T L wrote: >>> >>> > Just like what expected for constants. >>> >>> For constants it's expected to reuse the last iota expression when >>> absent. Do you propose that >>> >>> var ( >>> a = iota >>> b >>> ) >>> >>> will become valid and initialize a to 0 and b to 1? >>> >>> If so, is it valid and what shall happen when one writes >>> >>> var ( >>> a = iota >>> b >>> s string >>> d >>> ) >>> >>> ? >>> >> >> The rule is same for constants: d is also string, as s. >> >> >> >>> >>> If it's not valid, why? >>> >>> >>> -- >>> >>> -j >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Wed, May 3, 2017 at 7:04 PM, T L wrote: > > > On Thursday, May 4, 2017 at 12:46:47 AM UTC+8, Axel Wagner wrote: >> >> but >> const ( >> a = iota >> b >> s string >> d >> ) >> is not a valid declaration. You can't say "the rule is the same for >> constants". >> > > For the same rule, I mean just copying the corresponding part from last > line. > Yes, declared constant must be assigned. This is an unrelated rule for > this topic. > No, it is not an unrelated rule. Because it means that "just like for consts" isn't an argument. You need, at the very least, answer the valid question ("what happens with that var-declaration and why?") raised about your proposal. Or better yet, realize that var and const declarations behave very differently and thus "consistency" isn't an argument to add something otherwise useless. > > >> >> Again: const-declarations and variable declarations are very different. >> You can not argue "it's the same"; it's not. >> >> On Wed, May 3, 2017 at 6:28 PM, T L wrote: >> >>> >>> >>> On Thursday, May 4, 2017 at 12:17:13 AM UTC+8, Jan Mercl wrote: On Wed, May 3, 2017 at 6:00 PM T L wrote: > Just like what expected for constants. For constants it's expected to reuse the last iota expression when absent. Do you propose that var ( a = iota b ) will become valid and initialize a to 0 and b to 1? If so, is it valid and what shall happen when one writes var ( a = iota b s string d ) ? >>> >>> The rule is same for constants: d is also string, as s. >>> >>> >>> If it's not valid, why? -- -j >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "golang-nuts" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to golang-nuts...@googlegroups.com. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Thursday, May 4, 2017 at 1:21:52 AM UTC+8, Axel Wagner wrote: > > On Wed, May 3, 2017 at 7:04 PM, T L > > wrote: > >> >> >> On Thursday, May 4, 2017 at 12:46:47 AM UTC+8, Axel Wagner wrote: >>> >>> but >>> const ( >>> a = iota >>> b >>> s string >>> d >>> ) >>> is not a valid declaration. You can't say "the rule is the same for >>> constants". >>> >> >> For the same rule, I mean just copying the corresponding part from last >> line. >> Yes, declared constant must be assigned. This is an unrelated rule for >> this topic. >> > > No, it is not an unrelated rule. Because it means that "just like for > consts" isn't an argument. You need, at the very least, answer the valid > question ("what happens with that var-declaration and why?") raised about > your proposal. Or better yet, realize that var and const declarations > behave very differently and thus "consistency" isn't an argument to add > something otherwise useless. > > ok, I admit the rule difference between variable and constant declaration does matter: var ( a int = iota b// should autocomplete c int// but this? "c int" is already legal. ) > >> >> >>> >>> Again: const-declarations and variable declarations are very different. >>> You can not argue "it's the same"; it's not. >>> >>> On Wed, May 3, 2017 at 6:28 PM, T L wrote: >>> On Thursday, May 4, 2017 at 12:17:13 AM UTC+8, Jan Mercl wrote: > > On Wed, May 3, 2017 at 6:00 PM T L wrote: > > > Just like what expected for constants. > > For constants it's expected to reuse the last iota expression when > absent. Do you propose that > > var ( > a = iota > b > ) > > will become valid and initialize a to 0 and b to 1? > > If so, is it valid and what shall happen when one writes > > var ( > a = iota > b > s string > d > ) > > ? > The rule is same for constants: d is also string, as s. > > If it's not valid, why? > > > -- > > -j > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On 4 May 2017 at 03:52, T L wrote: > > > On Thursday, May 4, 2017 at 1:21:52 AM UTC+8, Axel Wagner wrote: >> >> On Wed, May 3, 2017 at 7:04 PM, T L wrote: >>> >>> >>> >>> On Thursday, May 4, 2017 at 12:46:47 AM UTC+8, Axel Wagner wrote: but const ( a = iota b s string d ) is not a valid declaration. You can't say "the rule is the same for constants". >>> >>> >>> For the same rule, I mean just copying the corresponding part from last >>> line. >>> Yes, declared constant must be assigned. This is an unrelated rule for >>> this topic. >> >> >> No, it is not an unrelated rule. Because it means that "just like for >> consts" isn't an argument. You need, at the very least, answer the valid >> question ("what happens with that var-declaration and why?") raised about >> your proposal. Or better yet, realize that var and const declarations behave >> very differently and thus "consistency" isn't an argument to add something >> otherwise useless. >> > > ok, I admit the rule difference between variable and constant declaration > does matter: > > var ( > a int = iota > b// should autocomplete > c int// but this? "c int" is already legal. > ) I don't think I've ever come across a case where I want to assign increasing-by-one values to adjacent variables. Have you? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [go-nuts] why iota can't be assigned to variables?
On Thursday, May 4, 2017 at 4:05:06 PM UTC+8, rog wrote: > > On 4 May 2017 at 03:52, T L > wrote: > > > > > > On Thursday, May 4, 2017 at 1:21:52 AM UTC+8, Axel Wagner wrote: > >> > >> On Wed, May 3, 2017 at 7:04 PM, T L wrote: > >>> > >>> > >>> > >>> On Thursday, May 4, 2017 at 12:46:47 AM UTC+8, Axel Wagner wrote: > > but > const ( > a = iota > b > s string > d > ) > is not a valid declaration. You can't say "the rule is the same for > constants". > >>> > >>> > >>> For the same rule, I mean just copying the corresponding part from > last > >>> line. > >>> Yes, declared constant must be assigned. This is an unrelated rule for > >>> this topic. > >> > >> > >> No, it is not an unrelated rule. Because it means that "just like for > >> consts" isn't an argument. You need, at the very least, answer the > valid > >> question ("what happens with that var-declaration and why?") raised > about > >> your proposal. Or better yet, realize that var and const declarations > behave > >> very differently and thus "consistency" isn't an argument to add > something > >> otherwise useless. > >> > > > > ok, I admit the rule difference between variable and constant > declaration > > does matter: > > > > var ( > > a int = iota > > b// should autocomplete > > c int// but this? "c int" is already legal. > > ) > > I don't think I've ever come across a case where I want to assign > increasing-by-one values to adjacent variables. Have you? > I never used iota for declaring constants too, :) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.