sorry i dont share your enthusiast for this exercise :s And tbhonnest, 
again, i never use most of those operators.
And if you d write this kind of thing in my sources, i d go format them 
immediately!!

On Monday, October 31, 2016 at 9:56:13 PM UTC+1, Pietro Gagliardi (andlabs) 
wrote:
>
> In addition, here's a few exercises. What do the following get tokenized 
> as?
>
> &^==
> &&^
> <<-
> ++=
> -&^
> /^*
>
> On Oct 31, 2016, at 4:48 PM, Pietro Gagliardi <and...@lostsig.net 
> <javascript:>> wrote:
>
> In Go, as in most languages, spaces do not *have to* delimit tokens. A 
> token ends when the leftmost longest matching token is found, and the rest 
> is placed back in the input buffer for the next token. So
>
> &&& true
> 1) read & — this can be &, &=, &&, &^, or &^=, so read again
> 2) read & — we now have &&, can't go further so give && to parser
> 3) read & — this can be &, &=, &&, &^, or &^=, so read again
> 4) read space — no match; give the & we have saved to the parser, then 
> ignore the space
> 5) read "true" (which itself breaks down into steps like the above)
>
> I know there are some languages (like Swift) which allow you to create 
> your own operators, and thus have certain rules for significant spaces; to 
> my knowledge, these are in the minority.
>
> On Oct 31, 2016, at 3:45 PM, mhh...@gmail.com <javascript:> wrote:
>
> Hi,
>
> noticed that an instant ago,
>
> package main
> import (
>     "fmt"
> )
>
> func main() {
>     if true &&& true &&& false {
>         fmt.Println("ok")
>     }
> }
>
> Gives this output,
>
> tmp/sandbox074568120/main.go:8: cannot take the address of true
>> tmp/sandbox074568120/main.go:8: invalid operation: true && &true (mismatched 
>> types bool and *bool)
>> tmp/sandbox074568120/main.go:8: cannot take the address of false
>>
>>
> the triple ampersands is parsed as : 
>
> true && &true
>
> No syntax error is reported :/ &&& is not intended, its a typo and should 
> be reported so.
>
> In my simple example its still ok because another error pops in to prevent 
> that.
>
> But in my real life example it passes, This code builds fine, maybe with 
> side effects, i m not sure.
> func (i *InputResolver) setResult(value interface{}, err error) {
>   if err!=nil &&& i.LastValue!=nil &&& i.LastErr==nil{
>     return // skip the new set as it reports error in producing and that 
> the last value did produce properly.
>   }
>   i.LastValue = value
>   i.LastErr = err
> }
>
>
>
> -- 
> 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 <javascript:>.
> 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 <javascript:>.
> 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.

Reply via email to