[go-nuts] Re: Question about casting

2018-02-18 Thread Krzysztof Kowalczyk
2 things:

1. plus() returns interface{}. 

"%T" prints underlying dynamic type of interface{} value, but static type 
of returned value of plus is interface{}

You can assign any type to interface{} without a cast by definition (see 
e.g. https://www.programming-books.io/essential/go/a-90100072-empty-interface)

What it means is this is valid in Go:

var v interface{}
v = 5 // no cast needed
v = "foo" // no cast needed

interface{} is Go's version of dynamic type. It wraps any type as a tuple 
(type, value).

2. Let's expand plus() function:

func plus(a, b interface{}) interface{} { 
  aInt := a.(myInt) // type: myInt
  bInt := b.(myInt) // type: myInt
  res := aInt + bInt // type: myInt
  var ires interface{} = res; // no cast needed, see above
  return ires
}

Hope this clarifies the typing.

Aside: if you come from C++, aliasing interface{} as any might feel 
comfortable, but that's not a good Go style.


On Saturday, February 17, 2018 at 9:03:58 PM UTC-8, Bill Wood wrote:
>
> HI, Go newbie here... not sure if this is a dumb question or not :)
>
> I have a simple program:
>
> package main
>
> import "fmt"
>
> type any interface{}
> type myInt int
>
> func plus(a, b any) any { return a.(myInt) + b.(myInt) }
>
> func main() {
> s := plus(myInt(3), myInt(2))
> fmt.Printf("%v, %T\n", s, s)
> }
>
>
> Output:
>
> 5, main.myInt
>
>
>  Why does func plus return a myInt?  Why isn't a cast needed, ie:
>
> func plus(a, b any) any { return myInt(a.(myInt) + b.(myInt)) }
>
>
> Thanks! 
>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
:like:
tanks you.

so go.y is for go compiler and cc.y is for go-c compiler.

all `.go` files require go compiler.
and what files require go-c compiler?

may tell some example file then is go-c?

On Monday, February 19, 2018 at 2:32:02 AM UTC+3:30, Dave Cheney wrote:
>
> In Go 1.4 the project contained both .go files and .c files. It shipped 
> with two compilers, a go compiler, called gc, and a c compiler called cc.
>
> > /go/src/cmd/gc/go.y
>
> This is the input file for the yacc grammar for the Go 1.4 go compiler 
>
> > /go/src/cmd/cc/cc.y
>
> This is the input file for the yacc grammar for the Go 1.4 c compiler 
>
> The same advice applies to the other two files you mentioned.
>
> On Monday, 19 February 2018 09:57:21 UTC+11, Compiler wrote:
>>
>> yeah , in go1.4 version,i want know difference between files.
>> ?!
>>
>> On Monday, February 19, 2018 at 2:04:09 AM UTC+3:30, Ian Lance Taylor 
>> wrote:
>>>
>>> On Sun, Feb 18, 2018 at 9:23 AM, Compiler  wrote: 
>>> > #Question 
>>> > 
>>> > What is the difference between using the following two files? 
>>> > 
>>> > /go/src/cmd/gc/go.y 
>>> > /go/src/cmd/cc/cc.y 
>>> > 
>>> > - 
>>> > #Question 
>>> > 
>>> > What is the difference between using the following two files? 
>>> > 
>>> > /go/src/cmd/gc/lex.c 
>>> > /go/src/cmd/cc/lex.c 
>>>
>>> You must be looking at a very old version of Go, as current versions 
>>> of Go do not contain either file. 
>>>
>>> Old versions of Go shipped with a C compiler that was used to build 
>>> parts of the runtime that were written in C.  Those parts were 
>>> rewritten into Go, and Go no longer ships a C compiler.  Back then, 
>>> the Go compiler was in cmd/gc and the C compiler was in cmd/cc. 
>>>
>>> Ian 
>>>
>>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
I feel like we’ve had this same discussion a few months ago.

Ian has mentioned that go 1.4 is no longer in use (it exists only in a very 
special case or bootstrapping from source).

Can you please give some context to your questions so we may assist you better.

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
Can build only c(own) compiler using a c compiler(like gcc) without go from 
this source?!


On Monday, February 19, 2018 at 2:48:26 AM UTC+3:30, Dave Cheney wrote:
>
> I feel like we’ve had this same discussion a few months ago. 
>
> Ian has mentioned that go 1.4 is no longer in use (it exists only in a 
> very special case or bootstrapping from source). 
>
> Can you please give some context to your questions so we may assist you 
> better.

-- 
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.


[go-nuts] Re: Dero: CryptoNote protocol + smart contracts using golang

2018-02-18 Thread Dave Cheney
Is there a reason DERO chose to go with their own licence rather than a 
BSD, MIT, or Apache 2 licence?


On Monday, 19 February 2018 16:10:14 UTC+11, 867crypt...@gmail.com wrote:
>
> Hello, my name is Serena, I’m the Community Manager at a blockchain 
> project called Dero. We use a protocol called CryptoNote that was 
> originally written in C++. The developers at the Dero Project have 
> rewritten most of the (CryptoNote) codebase to golang and we would like to 
> start some discussion within the development and open source communities.
>
>
> The core cryptography and functionally (rewritten in golang) is working 
> and available on GitHub for limited evaluation and testing. We would 
> genuinely value the feedback from this community. The following is what 
> I’ve posted to a couple other communities as well. (I would like to 
> emphasize that this project is currently pre-alpha but your input (the 
> google community) in particular is important to us.)
>
>
> *DERO: Privacy + Smart Contracts*
>
>
> Dero at present is a code fork of Monero (Helium Hydra) with the Bytecoin 
> CryptoNote protocol.
>
> Dero will be a completely new blockchain technology integrating the 
> CryptoNote protocol with new smart contract controls.
>
> *Dero is being rewritten from C++ to Golang (Google Language) to bring 
> together CryptoNote and smart contracts on the Dero blockchain.*
>
>
> *CryptoNote protocol implementation in Golang is almost completed and 
> available on GitHub for basic testing/evaluation.*
>
>
> *GitHub:* https://github.com/deroproject/derosuite (Golang version for 
> testing purposes only at this time)
>
>
> *Bitcointalk:* https://bitcointalk.org/index.php?topic=2525508.0
>
>
> Dero has a very welcoming community and we would enjoy the opportunity to 
> have you join us!
>
>
> *FULL DISCLOSURE:Dero has a very welcoming community and we would enjoy 
> the opportunity to have you join us!*
>
>
> *FULL DISCLOSURE:* My name is Serena, I’m the Community Manager at the 
> Dero Project
>

-- 
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] About Go Compiler!

2018-02-18 Thread Michael Jones
...you might also want to read the papers about META II. This was memorably
inspired work from 1965 that is still marvelous.
http://www.ibm-1401.info/Meta-II-schorre.pdf

On Sun, Feb 18, 2018 at 5:46 PM, Pierpaolo Bernardi 
wrote:

> On Mon, Feb 19, 2018 at 1:44 AM, Compiler  wrote:
> > Performance of C with Optimize not better of Go at more time?!
> > so why re-write golang in go?
>
> Because a lot of people, obviously including Go implementors, think
> that Go is a better language than C for writing a compiler.
>
> Performance of the generated code is not the only criterium to use for
> evaluating a programming language.  Once the performance is good
> enough, other factors take more weight.
>
> --
> 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.
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
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.


[go-nuts] Dero: CryptoNote protocol + smart contracts using golang

2018-02-18 Thread 867cryptocurrency


Hello, my name is Serena, I’m the Community Manager at a blockchain project 
called Dero. We use a protocol called CryptoNote that was originally 
written in C++. The developers at the Dero Project have rewritten most of 
the (CryptoNote) codebase to golang and we would like to start some 
discussion within the development and open source communities.


The core cryptography and functionally (rewritten in golang) is working and 
available on GitHub for limited evaluation and testing. We would genuinely 
value the feedback from this community. The following is what I’ve posted 
to a couple other communities as well. (I would like to emphasize that this 
project is currently pre-alpha but your input (the google community) in 
particular is important to us.)


*DERO: Privacy + Smart Contracts*


Dero at present is a code fork of Monero (Helium Hydra) with the Bytecoin 
CryptoNote protocol.

Dero will be a completely new blockchain technology integrating the 
CryptoNote protocol with new smart contract controls.

*Dero is being rewritten from C++ to Golang (Google Language) to bring 
together CryptoNote and smart contracts on the Dero blockchain.*


*CryptoNote protocol implementation in Golang is almost completed and 
available on GitHub for basic testing/evaluation.*


*GitHub:* https://github.com/deroproject/derosuite (Golang version for 
testing purposes only at this time)


*Bitcointalk:* https://bitcointalk.org/index.php?topic=2525508.0


Dero has a very welcoming community and we would enjoy the opportunity to 
have you join us!


*FULL DISCLOSURE:Dero has a very welcoming community and we would enjoy the 
opportunity to have you join us!*


*FULL DISCLOSURE:* My name is Serena, I’m the Community Manager at the Dero 
Project

-- 
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] Re: Go 1.10 is released

2018-02-18 Thread Henrik Johansson
Thx,

Why I wondered was because to build script (a tiny settings file really)
for Archlinux uses this flag to build it's Go packages.
Is it available as a paranoia "i really need all the tests run"? Will it be
removed later on?



sön 18 feb. 2018 kl 23:04 skrev Ian Lance Taylor :

> On Sun, Feb 18, 2018 at 11:22 AM, Henrik Johansson 
> wrote:
> > The GOCACHE variable. What is it's effect when building Go itself?
> > It doesn't disable test caching when using the resulting go tools right?
>
> Right.
>
> Ian
>

-- 
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.


[go-nuts] Re: Client certificate in request missing

2018-02-18 Thread Miha Zoubek



Hello

just for puicture:



Dne petek, 16. februar 2018 17.01.40 UTC+1 je oseba Miha Zoubek napisala:
>
> Hello
>
> this is my code:
> https://play.golang.org/p/yxhYXEVMPjB
>
>
> I got certificate in pfx format, I extraced client, CA, private 
> certificate which i imported in my program.
> # Extract Public Key (ask for password)
> openssl pkcs12 -in file.pfx -out file_public.pem -clcerts -nokeys
>
> # Extract Certificate Authority Key (ask for password)
> openssl pkcs12 -in file.pfx -out file_ca.pem -cacerts -nokeys
>
> # Extract Private Key (ask for password)
> openssl pkcs12 -in file.pfx -out file_private.pem -nocerts -nodes
>
>
> I need to send certificate in request to server but the thing is that i 
> get from server that certificate is not included in request. I did trace 
> also with WireShark and there is no certificate appanded in request.
>
>
> Thank you for all your help!
> miha
>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
/go/src/cmd/cc/
this directory is base of c-compiler.

so not `.c` file in /src/.

On Monday, February 19, 2018 at 3:01:35 AM UTC+3:30, Compiler wrote:
>
> mean all `.c` file in /src/ compile using own c-compiler?!
>
> On Monday, February 19, 2018 at 2:49:40 AM UTC+3:30, Dave Cheney wrote:
>>
>> > which files require go-c compiler?
>>
>> The ones in the go 1.4distributuon that end in .c. 
>>
>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
If you want to learn more about the Go compiler then you must stop living 
in the past. Go 1.4 is _dead_. The current compiler is written in pure go 
and you can find the sources 
here https://github.com/golang/go/tree/master/src/cmd/compile/internal

We cannot help you use the old Go 1.4 c compiler to write a compiler. 
Someone may want to pursue that as a project, but not on this mailing list. 
This mailing list is for talking about Go. 

On Monday, 19 February 2018 10:59:32 UTC+11, Compiler wrote:
>
> I have some experience in writing lexer,parser,interpreter,optimize.
> I've also worked generate output code(example one language to another).
>
> currently example i'm design a interpreter and for final step( generate 
> output file) using another compiler.
>
> i'm want know more about compiler... and trying them.
>
> I mean the compiler : self compiler
>
> On Monday, February 19, 2018 at 3:22:27 AM UTC+3:30, Dave Cheney wrote:
>>
>> Stop.
>>
>> What do you want to do?
>>
>> Do you want to write a C compiler ?
>>
>> On Monday, 19 February 2018 10:47:24 UTC+11, Compiler wrote:
>>>
>>> https://groups.google.com/forum/#!topic/golang-nuts/24pSm-B3FqU
>>>
>>> On Monday, February 19, 2018 at 3:14:48 AM UTC+3:30, Dave Cheney wrote:


 Who is they? Can you give some more context.

>>>

-- 
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] printing a struct fields that implements an error interface

2018-02-18 Thread Jamil Djadala
On Sat, 17 Feb 2018 16:05:42 -0800 (PST)
Joseph Lorenzini  wrote:

> Hi all:
> 
> Per documentation:
> 
> "If an operand implements the error interface, the Error method will
> be invoked to convert the object to a string, which will then be
> formatted as required by the verb (if any)"
> 
> And this is so even if the struct implements the stringer interface.
> So if I print the struct, I get the error value. Is there anyway to
> force fmt.Print to output the struct fields, even when it implements
> the error interface? 
> 
> Thanks,
> Joe 
> 

Just use fmt.Print(v.String()) instead of fmt.Print(v)

-- 
Jamil Djadala

-- 
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] Re: Question about casting

2018-02-18 Thread Jan Mercl
On Sun, Feb 18, 2018 at 8:06 PM Bill Wood  wrote:

> I thought that the plus operator would return an int, not a myInt.

expr1 + expr2 works iff types of expr1 and expr2 are the same and the
result has the same type as both of the operands. Analogically for the
subtraction, multiplication and division operations.

-- 

-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] About Go Compiler!

2018-02-18 Thread Dave Cheney
In Go 1.4 the project contained both .go files and .c files. It shipped 
with two compilers, a go compiler, called gc, and a c compiler called cc.

> /go/src/cmd/gc/go.y

This is the input file for the yacc grammar for the Go 1.4 go compiler 

> /go/src/cmd/cc/cc.y

This is the input file for the yacc grammar for the Go 1.4 c compiler 

The same advice applies to the other two files you mentioned.

On Monday, 19 February 2018 09:57:21 UTC+11, Compiler wrote:
>
> yeah , in go1.4 version,i want know difference between files.
> ?!
>
> On Monday, February 19, 2018 at 2:04:09 AM UTC+3:30, Ian Lance Taylor 
> wrote:
>>
>> On Sun, Feb 18, 2018 at 9:23 AM, Compiler  wrote: 
>> > #Question 
>> > 
>> > What is the difference between using the following two files? 
>> > 
>> > /go/src/cmd/gc/go.y 
>> > /go/src/cmd/cc/cc.y 
>> > 
>> > - 
>> > #Question 
>> > 
>> > What is the difference between using the following two files? 
>> > 
>> > /go/src/cmd/gc/lex.c 
>> > /go/src/cmd/cc/lex.c 
>>
>> You must be looking at a very old version of Go, as current versions 
>> of Go do not contain either file. 
>>
>> Old versions of Go shipped with a C compiler that was used to build 
>> parts of the runtime that were written in C.  Those parts were 
>> rewritten into Go, and Go no longer ships a C compiler.  Back then, 
>> the Go compiler was in cmd/gc and the C compiler was in cmd/cc. 
>>
>> Ian 
>>
>

-- 
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] About Go Compiler!

2018-02-18 Thread Michael Jones
much better!  i suggest Google searches about bootstrapping, self-hosting,
and security.

On Sun, Feb 18, 2018 at 3:59 PM, Compiler  wrote:

> I have some experience in writing lexer,parser,interpreter,optimize.
> I've also worked generate output code(example one language to another).
>
> currently example i'm design a interpreter and for final step( generate
> output file) using another compiler.
>
> i'm want know more about compiler... and trying them.
>
> I mean the compiler : self compiler
>
> On Monday, February 19, 2018 at 3:22:27 AM UTC+3:30, Dave Cheney wrote:
>>
>> Stop.
>>
>> What do you want to do?
>>
>> Do you want to write a C compiler ?
>>
>> On Monday, 19 February 2018 10:47:24 UTC+11, Compiler wrote:
>>>
>>> https://groups.google.com/forum/#!topic/golang-nuts/24pSm-B3FqU
>>>
>>> On Monday, February 19, 2018 at 3:14:48 AM UTC+3:30, Dave Cheney wrote:


 Who is they? Can you give some more context.

>>> --
> 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.
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
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] About Go Compiler!

2018-02-18 Thread Pierpaolo Bernardi
On Mon, Feb 19, 2018 at 1:44 AM, Compiler  wrote:
> Performance of C with Optimize not better of Go at more time?!
> so why re-write golang in go?

Because a lot of people, obviously including Go implementors, think
that Go is a better language than C for writing a compiler.

Performance of the generated code is not the only criterium to use for
evaluating a programming language.  Once the performance is good
enough, other factors take more weight.

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
Show me some files 
at https://storage.googleapis.com/golang/go1.4-bootstrap-20170531.tar.gz 
then require go-c compiler.

On Monday, February 19, 2018 at 2:35:18 AM UTC+3:30, Compiler wrote:
>
> :like:
> tanks you.
>
> so go.y is for go compiler and cc.y is for go-c compiler.
>
> all `.go` files require go compiler.
> and what files require go-c compiler?
>
> may tell some example file then is go-c?
>
> On Monday, February 19, 2018 at 2:32:02 AM UTC+3:30, Dave Cheney wrote:
>>
>> In Go 1.4 the project contained both .go files and .c files. It shipped 
>> with two compilers, a go compiler, called gc, and a c compiler called cc.
>>
>> > /go/src/cmd/gc/go.y
>>
>> This is the input file for the yacc grammar for the Go 1.4 go compiler 
>>
>> > /go/src/cmd/cc/cc.y
>>
>> This is the input file for the yacc grammar for the Go 1.4 c compiler 
>>
>> The same advice applies to the other two files you mentioned.
>>
>> On Monday, 19 February 2018 09:57:21 UTC+11, Compiler wrote:
>>>
>>> yeah , in go1.4 version,i want know difference between files.
>>> ?!
>>>
>>> On Monday, February 19, 2018 at 2:04:09 AM UTC+3:30, Ian Lance Taylor 
>>> wrote:

 On Sun, Feb 18, 2018 at 9:23 AM, Compiler  wrote: 
 > #Question 
 > 
 > What is the difference between using the following two files? 
 > 
 > /go/src/cmd/gc/go.y 
 > /go/src/cmd/cc/cc.y 
 > 
 > - 
 > #Question 
 > 
 > What is the difference between using the following two files? 
 > 
 > /go/src/cmd/gc/lex.c 
 > /go/src/cmd/cc/lex.c 

 You must be looking at a very old version of Go, as current versions 
 of Go do not contain either file. 

 Old versions of Go shipped with a C compiler that was used to build 
 parts of the runtime that were written in C.  Those parts were 
 rewritten into Go, and Go no longer ships a C compiler.  Back then, 
 the Go compiler was in cmd/gc and the C compiler was in cmd/cc. 

 Ian 

>>>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
Performance of C with Optimize not better of Go at more time?!
so why re-write golang in go?

On Monday, February 19, 2018 at 3:54:08 AM UTC+3:30, Compiler wrote:
>
> When Golang using *bootstrapping **technique* , performance not Decrease?
>
> On Monday, February 19, 2018 at 3:42:18 AM UTC+3:30, Compiler wrote:
>>
>> *bootstrapping* is the technique for producing a self-compiling compiler 
>> 
>>
>> On Monday, February 19, 2018 at 3:40:54 AM UTC+3:30, Compiler wrote:
>>>
>>> whats difference between self-hosting compiler vs Bootstrapping compiler?
>>>
>>> https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
>>>
>>> On Monday, February 19, 2018 at 3:34:48 AM UTC+3:30, Michael Jones wrote:

 much better!  i suggest Google searches about bootstrapping, 
 self-hosting, and security.

>>>

-- 
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] About Go Compiler!

2018-02-18 Thread Michael Jones
At the core of this is the simple fact that you have to start somewhere.

The founding Go team had experience (UNIX, B, C, Plan 9, Pic, Blit, GNU
C/C++, ...) and well-understood code on hand from prior work (assembler,
compilers, and a linker that all worked together). Also, it is dangerous to
build New in New because as you learn your mistakes and want to make big
changes it is harder because that means breaking the thread by which all
the system hangs together.

This is where it started--because that was practical for both reasons. Once
there was Go 1, and after a few iterations, (Go 1,4) the stability was
there and the promise was there and it became time to implement Go in Go.
That happened. Now that is all distant memory to people and nobody's focus.

On Sun, Feb 18, 2018 at 4:24 PM, Compiler  wrote:

> When Golang using *bootstrapping **technique* , performance not Decrease?
>
> On Monday, February 19, 2018 at 3:42:18 AM UTC+3:30, Compiler wrote:
>>
>> *bootstrapping* is the technique for producing a self-compiling compiler
>> 
>>
>> On Monday, February 19, 2018 at 3:40:54 AM UTC+3:30, Compiler wrote:
>>>
>>> whats difference between self-hosting compiler vs Bootstrapping compiler?
>>>
>>> https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
>>>
>>> On Monday, February 19, 2018 at 3:34:48 AM UTC+3:30, Michael Jones wrote:

 much better!  i suggest Google searches about bootstrapping,
 self-hosting, and security.

>>> --
> 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.
>



-- 
Michael T. Jones
michael.jo...@gmail.com

-- 
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] Re: Question about casting

2018-02-18 Thread Krzysztof Kowalczyk
I'm far from the expert on the spec but the behavior seems to follow the 
rules.

https://golang.org/ref/spec#Arithmetic_operators

"Arithmetic operators apply to numeric values and yield a result of the 
same type as the first operand."

myInt + myInt returns myInt because it's the type of first operand.

Is myInt a "numeric value"?

https://golang.org/ref/spec#Type_declarations

"A type definition creates a new, distinct type with the same underlying 
type  and operations as the given type, 
and binds an identifier to it."

myInt is a distinct type from int, but it has the same underlying type and 
is therefore "numeric value".



On Sunday, February 18, 2018 at 11:30:58 AM UTC-8, Bill Wood wrote:
>
> Thanks.  Why is the plus operator defined on myInt?  Or if it simply 
> treats a myInt as an int, why isn't the result an int?
>
> Sorry if this is a stupid question; I think either there is something 
> deeper to this or else the arithmetic operators just have a special 
> processing for this case.
>
> On Sunday, February 18, 2018 at 2:16:17 PM UTC-5, Jan Mercl wrote:
>>
>> On Sun, Feb 18, 2018 at 8:06 PM Bill Wood  wrote:
>>
>> > I thought that the plus operator would return an int, not a myInt.
>>
>> expr1 + expr2 works iff types of expr1 and expr2 are the same and the 
>> result has the same type as both of the operands. Analogically for the 
>> subtraction, multiplication and division operations.
>>
>> -- 
>>
>> -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] About Go Compiler!

2018-02-18 Thread Compiler
Example :

 -  /go/src/fmt/print.go
 -  /go/src/io/multi.go

this files require go compiler (go.y).
-

which files require go-c compiler(c.y)
??
  
On Monday, February 19, 2018 at 2:40:36 AM UTC+3:30, Compiler wrote:
>
> Show me some files at 
> https://storage.googleapis.com/golang/go1.4-bootstrap-20170531.tar.gz 
> then require go-c compiler.
>
> On Monday, February 19, 2018 at 2:35:18 AM UTC+3:30, Compiler wrote:
>>
>> :like:
>> tanks you.
>>
>> so go.y is for go compiler and cc.y is for go-c compiler.
>>
>> all `.go` files require go compiler.
>> and what files require go-c compiler?
>>
>> may tell some example file then is go-c?
>>
>> On Monday, February 19, 2018 at 2:32:02 AM UTC+3:30, Dave Cheney wrote:
>>>
>>> In Go 1.4 the project contained both .go files and .c files. It shipped 
>>> with two compilers, a go compiler, called gc, and a c compiler called cc.
>>>
>>> > /go/src/cmd/gc/go.y
>>>
>>> This is the input file for the yacc grammar for the Go 1.4 go compiler 
>>>
>>> > /go/src/cmd/cc/cc.y
>>>
>>> This is the input file for the yacc grammar for the Go 1.4 c compiler 
>>>
>>> The same advice applies to the other two files you mentioned.
>>>
>>> On Monday, 19 February 2018 09:57:21 UTC+11, Compiler wrote:

 yeah , in go1.4 version,i want know difference between files.
 ?!

 On Monday, February 19, 2018 at 2:04:09 AM UTC+3:30, Ian Lance Taylor 
 wrote:
>
> On Sun, Feb 18, 2018 at 9:23 AM, Compiler  
> wrote: 
> > #Question 
> > 
> > What is the difference between using the following two files? 
> > 
> > /go/src/cmd/gc/go.y 
> > /go/src/cmd/cc/cc.y 
> > 
> > - 
> > #Question 
> > 
> > What is the difference between using the following two files? 
> > 
> > /go/src/cmd/gc/lex.c 
> > /go/src/cmd/cc/lex.c 
>
> You must be looking at a very old version of Go, as current versions 
> of Go do not contain either file. 
>
> Old versions of Go shipped with a C compiler that was used to build 
> parts of the runtime that were written in C.  Those parts were 
> rewritten into Go, and Go no longer ships a C compiler.  Back then, 
> the Go compiler was in cmd/gc and the C compiler was in cmd/cc. 
>
> Ian 
>


-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
Assembly?!
but not exist many `.asm` files at source.
Also, I had already asked ...
And they said they were not with the assembly and is generate executable 
file using object file.

On Monday, February 19, 2018 at 3:08:51 AM UTC+3:30, Dave Cheney wrote:
>
>
>
> On Monday, 19 February 2018 10:33:16 UTC+11, Compiler wrote:
>>
>> /go/src/cmd/cc/
>> this directory is base of c-compiler.
>>
>
> yes, that is where the shared parts of the c compiler lives, the 
> architecture specific parts were in 5c, 6c, 8c, etc.
>  
>
>>
>> so not `.c` file in /src/.
>>
>
> You can answer this question yourself by looking in the tarball. The Go 
> 1.4 runtime was written in a mixture of Go, C, and Assembly. 
>
>>
>> On Monday, February 19, 2018 at 3:01:35 AM UTC+3:30, Compiler wrote:
>>>
>>> mean all `.c` file in /src/ compile using own c-compiler?!
>>>
>>> On Monday, February 19, 2018 at 2:49:40 AM UTC+3:30, Dave Cheney wrote:

 > which files require go-c compiler?

 The ones in the go 1.4distributuon that end in .c. 

>>>

-- 
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] Re: Go 1.10 is released

2018-02-18 Thread Ian Lance Taylor
On Sun, Feb 18, 2018 at 11:22 AM, Henrik Johansson  wrote:
> The GOCACHE variable. What is it's effect when building Go itself?
> It doesn't disable test caching when using the resulting go tools right?

Right.

Ian

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
yeah , in go1.4 version,i want know difference between files.
?!

On Monday, February 19, 2018 at 2:04:09 AM UTC+3:30, Ian Lance Taylor wrote:
>
> On Sun, Feb 18, 2018 at 9:23 AM, Compiler  > wrote: 
> > #Question 
> > 
> > What is the difference between using the following two files? 
> > 
> > /go/src/cmd/gc/go.y 
> > /go/src/cmd/cc/cc.y 
> > 
> > - 
> > #Question 
> > 
> > What is the difference between using the following two files? 
> > 
> > /go/src/cmd/gc/lex.c 
> > /go/src/cmd/cc/lex.c 
>
> You must be looking at a very old version of Go, as current versions 
> of Go do not contain either file. 
>
> Old versions of Go shipped with a C compiler that was used to build 
> parts of the runtime that were written in C.  Those parts were 
> rewritten into Go, and Go no longer ships a C compiler.  Back then, 
> the Go compiler was in cmd/gc and the C compiler was in cmd/cc. 
>
> Ian 
>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
> which files require go-c compiler?

The ones in the go 1.4distributuon that end in .c. 

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
> what files require the c compiler?

The c files in the go 1.4 distribution. 

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney


On Monday, 19 February 2018 10:42:12 UTC+11, Compiler wrote:
>
> Assembly?!
> but not exist many `.asm` files at source.
>

By tradition assembly files have .s and .S extensions
 

> Also, I had already asked ...
>

Already asked what? It might be easier if you give more background to the 
_problem_ you want to solve rather than asking random questions without 
context.
 

> And they said they were not with the assembly and is generate executable 
> file using object file.
>

Who is they? Can you give some more context.
 

>
> On Monday, February 19, 2018 at 3:08:51 AM UTC+3:30, Dave Cheney wrote:
>>
>>
>>
>> On Monday, 19 February 2018 10:33:16 UTC+11, Compiler wrote:
>>>
>>> /go/src/cmd/cc/
>>> this directory is base of c-compiler.
>>>
>>
>> yes, that is where the shared parts of the c compiler lives, the 
>> architecture specific parts were in 5c, 6c, 8c, etc.
>>  
>>
>>>
>>> so not `.c` file in /src/.
>>>
>>
>> You can answer this question yourself by looking in the tarball. The Go 
>> 1.4 runtime was written in a mixture of Go, C, and Assembly. 
>>
>>>
>>> On Monday, February 19, 2018 at 3:01:35 AM UTC+3:30, Compiler wrote:

 mean all `.c` file in /src/ compile using own c-compiler?!

 On Monday, February 19, 2018 at 2:49:40 AM UTC+3:30, Dave Cheney wrote:
>
> > which files require go-c compiler?
>
> The ones in the go 1.4distributuon that end in .c. 
>


-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
How can trying this?
Do not have an idea about it?


On Monday, February 19, 2018 at 3:10:04 AM UTC+3:30, Dave Cheney wrote:
>
> In theory, yes. In practice, I doubt it.
>
> On Monday, 19 February 2018 10:37:14 UTC+11, Compiler wrote:
>>
>> Can build only c(own) compiler using a c compiler(like gcc) without go 
>> from this source?!
>>
>>
>> On Monday, February 19, 2018 at 2:48:26 AM UTC+3:30, Dave Cheney wrote:
>>>
>>> I feel like we’ve had this same discussion a few months ago. 
>>>
>>> Ian has mentioned that go 1.4 is no longer in use (it exists only in a 
>>> very special case or bootstrapping from source). 
>>>
>>> Can you please give some context to your questions so we may assist you 
>>> better.
>>
>>

-- 
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.


[go-nuts] Re: Go 1.10 is released

2018-02-18 Thread Lucio


On Sunday, 18 February 2018 04:20:39 UTC+2, Dmitriy Cherchenko wrote:
>
> I like how the Go team isn't trying to support very old operating systems. 
> We should focus on modern systems and expect people to try to stay up to 
> date. Thank you!
>
> And be restricted to shrinking bio-diversity. How sad that people may 
perceive this as an asset!

Lucio.

-- 
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.


[go-nuts] Re: Question about casting

2018-02-18 Thread Bill Wood
Thanks, my question is about this line in your expanded plus function:

res := aInt + bInt // type: myInt


It's not clear to me why *aInt + bInt* results in a type myInt.  I thought 
that the plus operator would return an int, not a myInt.

On Sunday, February 18, 2018 at 3:00:00 AM UTC-5, Krzysztof Kowalczyk wrote:
>
> 2 things:
>
> 1. plus() returns interface{}. 
>
> "%T" prints underlying dynamic type of interface{} value, but static type 
> of returned value of plus is interface{}
>
> You can assign any type to interface{} without a cast by definition (see 
> e.g. 
> https://www.programming-books.io/essential/go/a-90100072-empty-interface)
>
> What it means is this is valid in Go:
>
> var v interface{}
> v = 5 // no cast needed
> v = "foo" // no cast needed
>
> interface{} is Go's version of dynamic type. It wraps any type as a tuple 
> (type, value).
>
> 2. Let's expand plus() function:
>
> func plus(a, b interface{}) interface{} { 
>   aInt := a.(myInt) // type: myInt
>   bInt := b.(myInt) // type: myInt
>   res := aInt + bInt // type: myInt
>   var ires interface{} = res; // no cast needed, see above
>   return ires
> }
>
> Hope this clarifies the typing.
>
> Aside: if you come from C++, aliasing interface{} as any might feel 
> comfortable, but that's not a good Go style.
>
>
> On Saturday, February 17, 2018 at 9:03:58 PM UTC-8, Bill Wood wrote:
>>
>> HI, Go newbie here... not sure if this is a dumb question or not :)
>>
>> I have a simple program:
>>
>> package main
>>
>> import "fmt"
>>
>> type any interface{}
>> type myInt int
>>
>> func plus(a, b any) any { return a.(myInt) + b.(myInt) }
>>
>> func main() {
>> s := plus(myInt(3), myInt(2))
>> fmt.Printf("%v, %T\n", s, s)
>> }
>>
>>
>> Output:
>>
>> 5, main.myInt
>>
>>
>>  Why does func plus return a myInt?  Why isn't a cast needed, ie:
>>
>> func plus(a, b any) any { return myInt(a.(myInt) + b.(myInt)) }
>>
>>
>> Thanks! 
>>
>

-- 
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] Re: Question about casting

2018-02-18 Thread Bill Wood
Thanks.  Why is the plus operator defined on myInt?  Or if it simply treats 
a myInt as an int, why isn't the result an int?

Sorry if this is a stupid question; I think either there is something 
deeper to this or else the arithmetic operators just have a special 
processing for this case.

On Sunday, February 18, 2018 at 2:16:17 PM UTC-5, Jan Mercl wrote:
>
> On Sun, Feb 18, 2018 at 8:06 PM Bill Wood  
> wrote:
>
> > I thought that the plus operator would return an int, not a myInt.
>
> expr1 + expr2 works iff types of expr1 and expr2 are the same and the 
> result has the same type as both of the operands. Analogically for the 
> subtraction, multiplication and division operations.
>
> -- 
>
> -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] About Go Compiler!

2018-02-18 Thread Ian Lance Taylor
On Sun, Feb 18, 2018 at 9:23 AM, Compiler  wrote:
> #Question
>
> What is the difference between using the following two files?
>
> /go/src/cmd/gc/go.y
> /go/src/cmd/cc/cc.y
>
> -
> #Question
>
> What is the difference between using the following two files?
>
> /go/src/cmd/gc/lex.c
> /go/src/cmd/cc/lex.c

You must be looking at a very old version of Go, as current versions
of Go do not contain either file.

Old versions of Go shipped with a C compiler that was used to build
parts of the runtime that were written in C.  Those parts were
rewritten into Go, and Go no longer ships a C compiler.  Back then,
the Go compiler was in cmd/gc and the C compiler was in cmd/cc.

Ian

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
In theory, yes. In practice, I doubt it.

On Monday, 19 February 2018 10:37:14 UTC+11, Compiler wrote:
>
> Can build only c(own) compiler using a c compiler(like gcc) without go 
> from this source?!
>
>
> On Monday, February 19, 2018 at 2:48:26 AM UTC+3:30, Dave Cheney wrote:
>>
>> I feel like we’ve had this same discussion a few months ago. 
>>
>> Ian has mentioned that go 1.4 is no longer in use (it exists only in a 
>> very special case or bootstrapping from source). 
>>
>> Can you please give some context to your questions so we may assist you 
>> better.
>
>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
Woow,

for Generate output file(executable file) Using only Asm?

So GoLang Using :

   1. *Go: *Runtime Libs
   2. *ASM: Only *Generate output file(executable file)
   3. 
*OwnC:  *


On Monday, February 19, 2018 at 3:14:48 AM UTC+3:30, Dave Cheney wrote:
>
> By tradition assembly files have .s and .S extensions
>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
Stop.

What do you want to do?

Do you want to write a C compiler ?

On Monday, 19 February 2018 10:47:24 UTC+11, Compiler wrote:
>
> https://groups.google.com/forum/#!topic/golang-nuts/24pSm-B3FqU
>
> On Monday, February 19, 2018 at 3:14:48 AM UTC+3:30, Dave Cheney wrote:
>>
>>
>> Who is they? Can you give some more context.
>>
>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney


On Monday, 19 February 2018 10:33:16 UTC+11, Compiler wrote:
>
> /go/src/cmd/cc/
> this directory is base of c-compiler.
>

yes, that is where the shared parts of the c compiler lives, the 
architecture specific parts were in 5c, 6c, 8c, etc.
 

>
> so not `.c` file in /src/.
>

You can answer this question yourself by looking in the tarball. The Go 1.4 
runtime was written in a mixture of Go, C, and Assembly. 

>
> On Monday, February 19, 2018 at 3:01:35 AM UTC+3:30, Compiler wrote:
>>
>> mean all `.c` file in /src/ compile using own c-compiler?!
>>
>> On Monday, February 19, 2018 at 2:49:40 AM UTC+3:30, Dave Cheney wrote:
>>>
>>> > which files require go-c compiler?
>>>
>>> The ones in the go 1.4distributuon that end in .c. 
>>>
>>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
whats difference between self-hosting compiler vs Bootstrapping compiler?

https://en.wikipedia.org/wiki/Bootstrapping_(compilers)

On Monday, February 19, 2018 at 3:34:48 AM UTC+3:30, Michael Jones wrote:
>
> much better!  i suggest Google searches about bootstrapping, self-hosting, 
> and security.
>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
*bootstrapping* is the technique for producing a self-compiling compiler 


On Monday, February 19, 2018 at 3:40:54 AM UTC+3:30, Compiler wrote:
>
> whats difference between self-hosting compiler vs Bootstrapping compiler?
>
> https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
>
> On Monday, February 19, 2018 at 3:34:48 AM UTC+3:30, Michael Jones wrote:
>>
>> much better!  i suggest Google searches about bootstrapping, 
>> self-hosting, and security.
>>
>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
When Golang using *bootstrapping **technique* , performance not Decrease?

On Monday, February 19, 2018 at 3:42:18 AM UTC+3:30, Compiler wrote:
>
> *bootstrapping* is the technique for producing a self-compiling compiler 
> 
>
> On Monday, February 19, 2018 at 3:40:54 AM UTC+3:30, Compiler wrote:
>>
>> whats difference between self-hosting compiler vs Bootstrapping compiler?
>>
>> https://en.wikipedia.org/wiki/Bootstrapping_(compilers)
>>
>> On Monday, February 19, 2018 at 3:34:48 AM UTC+3:30, Michael Jones wrote:
>>>
>>> much better!  i suggest Google searches about bootstrapping, 
>>> self-hosting, and security.
>>>
>>

-- 
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] Re: Go 1.10 is released

2018-02-18 Thread Henrik Johansson
The GOCACHE variable. What is it's effect when building Go itself?
It doesn't disable test caching when using the resulting go tools right?

sön 18 feb. 2018 kl 19:55 skrev Lucio :

>
>
> On Sunday, 18 February 2018 04:20:39 UTC+2, Dmitriy Cherchenko wrote:
>>
>> I like how the Go team isn't trying to support very old operating
>> systems. We should focus on modern systems and expect people to try to stay
>> up to date. Thank you!
>>
>> And be restricted to shrinking bio-diversity. How sad that people may
> perceive this as an asset!
>
> Lucio.
>
> --
> 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] Re: Question about casting

2018-02-18 Thread Bill Wood
Thanks! :)

On Sunday, February 18, 2018 at 3:11:45 PM UTC-5, Krzysztof Kowalczyk wrote:
>
> I'm far from the expert on the spec but the behavior seems to follow the 
> rules.
>
> https://golang.org/ref/spec#Arithmetic_operators
>
> "Arithmetic operators apply to numeric values and yield a result of the 
> same type as the first operand."
>
> myInt + myInt returns myInt because it's the type of first operand.
>
> Is myInt a "numeric value"?
>
> https://golang.org/ref/spec#Type_declarations
>
> "A type definition creates a new, distinct type with the same underlying 
> type  and operations as the given 
> type, and binds an identifier to it."
>
> myInt is a distinct type from int, but it has the same underlying type and 
> is therefore "numeric value".
>
>
>
> On Sunday, February 18, 2018 at 11:30:58 AM UTC-8, Bill Wood wrote:
>>
>> Thanks.  Why is the plus operator defined on myInt?  Or if it simply 
>> treats a myInt as an int, why isn't the result an int?
>>
>> Sorry if this is a stupid question; I think either there is something 
>> deeper to this or else the arithmetic operators just have a special 
>> processing for this case.
>>
>> On Sunday, February 18, 2018 at 2:16:17 PM UTC-5, Jan Mercl wrote:
>>>
>>> On Sun, Feb 18, 2018 at 8:06 PM Bill Wood  wrote:
>>>
>>> > I thought that the plus operator would return an int, not a myInt.
>>>
>>> expr1 + expr2 works iff types of expr1 and expr2 are the same and the 
>>> result has the same type as both of the operands. Analogically for the 
>>> subtraction, multiplication and division operations.
>>>
>>> -- 
>>>
>>> -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] About Go Compiler!

2018-02-18 Thread Compiler
mean all `.c` file in /src/ compile using own c-compiler?!

On Monday, February 19, 2018 at 2:49:40 AM UTC+3:30, Dave Cheney wrote:
>
> > which files require go-c compiler?
>
> The ones in the go 1.4distributuon that end in .c. 
>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
yes, up to Go 1.4, part of the go runtime was compiled using a c compiler 
which derived from the plan 9 c compilers. In fact, the c frontend and the 
go frontend shared the same code generation backends.

On Monday, 19 February 2018 10:31:35 UTC+11, Compiler wrote:
>
> mean all `.c` file in /src/ compile using own c-compiler?!
>
> On Monday, February 19, 2018 at 2:49:40 AM UTC+3:30, Dave Cheney wrote:
>>
>> > which files require go-c compiler?
>>
>> The ones in the go 1.4distributuon that end in .c. 
>>
>

-- 
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] About Go Compiler!

2018-02-18 Thread Compiler
I have some experience in writing lexer,parser,interpreter,optimize.
I've also worked generate output code(example one language to another).

currently example i'm design a interpreter and for final step( generate 
output file) using another compiler.

i'm want know more about compiler... and trying them.

I mean the compiler : self compiler

On Monday, February 19, 2018 at 3:22:27 AM UTC+3:30, Dave Cheney wrote:
>
> Stop.
>
> What do you want to do?
>
> Do you want to write a C compiler ?
>
> On Monday, 19 February 2018 10:47:24 UTC+11, Compiler wrote:
>>
>> https://groups.google.com/forum/#!topic/golang-nuts/24pSm-B3FqU
>>
>> On Monday, February 19, 2018 at 3:14:48 AM UTC+3:30, Dave Cheney wrote:
>>>
>>>
>>> Who is they? Can you give some more context.
>>>
>>

-- 
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] About Go Compiler!

2018-02-18 Thread Dave Cheney
I recommend watching this presentation from Russ Cox about why the Go team 
decided to rewrite the compiler from C to Go. 

https://www.youtube.com/watch?v=QIE5nV5fDwA

On Monday, 19 February 2018 11:44:23 UTC+11, Compiler wrote:
>
> Performance of C with Optimize not better of Go at more time?!
> so why re-write golang in go?
>
> On Monday, February 19, 2018 at 3:54:08 AM UTC+3:30, Compiler wrote:
>>
>> When Golang using *bootstrapping **technique* , performance not Decrease?
>>
>> On Monday, February 19, 2018 at 3:42:18 AM UTC+3:30, Compiler wrote:
>>>
>>> *bootstrapping* is the technique for producing a self-compiling compiler 
>>> 
>>>
>>> On Monday, February 19, 2018 at 3:40:54 AM UTC+3:30, Compiler wrote:

 whats difference between self-hosting compiler vs Bootstrapping 
 compiler?

 https://en.wikipedia.org/wiki/Bootstrapping_(compilers)

 On Monday, February 19, 2018 at 3:34:48 AM UTC+3:30, Michael Jones 
 wrote:
>
> much better!  i suggest Google searches about bootstrapping, 
> self-hosting, and security.
>


-- 
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] Re: All Forms of Wishful Generics

2018-02-18 Thread dc0d
Lars,

That's nice! Yet it's a sandboxed execution context. The Safe Packages 
mentioned above are just Go packages, with source code.

And when the day comes for a proper dependency manager, I would like to be 
able to tell the DM fail on import any unsafe packages - except for a list 
that I trust.

On Sunday, February 18, 2018 at 7:17:56 AM UTC+3:30, Lars Seipel wrote:
>
> On Sat, Feb 17, 2018 at 01:10:29AM -0800, dc0d wrote: 
> > There are other things too, that I would like to have in Go; like a 
> faster 
> > FFI/CGO, or safe packages by restricting features so that a Go package 
> > cannot harm the hosting machine or application, like Safe Tcl 
>
> Go already has a NaCl backend which might fit the bill. See 
> misc/nacl/README for how to set it up. It links to a design document 
> (https://golang.org/s/go13nacl) with some background. 
>

-- 
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.


[go-nuts] Re: printing a struct fields that implements an error interface

2018-02-18 Thread jake6502
There may be another way, but this is one way to print the struct fields:
https://play.golang.org/p/sGZMBGG7r79
See line 17. 

On Sunday, February 18, 2018 at 8:57:02 AM UTC-5, Diego Medina wrote:
>
> using %#v
>
> as in
>
> https://play.golang.org/p/VVqUVsfzx6e
>
>
>
> log.Printf("Hello, playground %#v\n", ret)
>
>
>
> On Saturday, February 17, 2018 at 7:05:42 PM UTC-5, Joseph Lorenzini wrote:
>>
>> Hi all:
>>
>> Per documentation:
>>
>> "If an operand implements the error interface, the Error method will be 
>> invoked to convert the object to a string, which will then be formatted as 
>> required by the verb (if any)"
>>
>> And this is so even if the struct implements the stringer interface. So 
>> if I print the struct, I get the error value. Is there anyway to force 
>> fmt.Print to output the struct fields, even when it implements the error 
>> interface? 
>>
>> Thanks,
>> Joe 
>>
>

-- 
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.


[go-nuts] About Go Compiler!

2018-02-18 Thread Compiler
#Question

What is the difference between using the following two files?

/go/src/cmd/gc/go.y
/go/src/cmd/cc/cc.y

-
#Question

What is the difference between using the following two files?

/go/src/cmd/gc/lex.c
/go/src/cmd/cc/lex.c



-- 
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.


[go-nuts] Re: Go 1.10 is released

2018-02-18 Thread Compiler
https://golang.org/pkg/plugin/

Not Forget this :
 Currently plugins are only supported on Linux and macOS.

On Friday, February 16, 2018 at 11:06:22 PM UTC+3:30, Andrew Bonventre 
wrote:
>
> Hello gophers,
>
> We just released Go 1.10.
>
> You can read the announcement blog post here:
>   https://blog.golang.org/go1.10
>
> You can download binary and source distributions from our download page:
>   https://golang.org/dl/
>
> To compile from source using a Git checkout, update to the release with 
> "git checkout go1.10" and build as usual.
>
> To find out what has changed, read the release notes:
>   https://golang.org/doc/go1.10
>
> Thanks to everyone who contributed to the release.
>
> Andy on behalf of the Go Team
>

-- 
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] printing a struct fields that implements an error interface

2018-02-18 Thread Jan Mercl
On Sun, Feb 18, 2018 at 1:06 AM Joseph Lorenzini  wrote:

> Is there anyway to force fmt.Print to output the struct fields, even when
it implements the error interface?

What exactly do you mean by "to output the struct fields"?


-- 

-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.


[go-nuts] Re: Proposal: return if any not nil

2018-02-18 Thread John Roth


On Sunday, February 18, 2018 at 12:47:09 AM UTC-7, Krzysztof Kowalczyk 
wrote:
>
> Even simpler:
>
> r, err := try os.Open("blah.text")
>
> Similar to Swift and what Rust used to have.
>
> "try foo()" means: if "foo()" returns an error, return the error to the 
> caller.
> If function returns multiple values, it would return zero value for 
> non-error values.
>
> I believe now Rust has the following syntax:
>
> r, err := os.Open("blah.text")?
>
> Either way, even less boilerplate.
>

Since the intention is to return on an error, it should only return if the 
last return value is a pointer and non-nill, not if any value does not have 
its zero value.

There are 8 suggestions under Error Handling in the Go Experience Reports. 
This should be written up and posted there if it isn't already covered.

-- 
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.


[go-nuts] Re: printing a struct fields that implements an error interface

2018-02-18 Thread Diego Medina
using %#v

as in

https://play.golang.org/p/VVqUVsfzx6e



log.Printf("Hello, playground %#v\n", ret)



On Saturday, February 17, 2018 at 7:05:42 PM UTC-5, Joseph Lorenzini wrote:
>
> Hi all:
>
> Per documentation:
>
> "If an operand implements the error interface, the Error method will be 
> invoked to convert the object to a string, which will then be formatted as 
> required by the verb (if any)"
>
> And this is so even if the struct implements the stringer interface. So if 
> I print the struct, I get the error value. Is there anyway to force 
> fmt.Print to output the struct fields, even when it implements the error 
> interface? 
>
> Thanks,
> Joe 
>

-- 
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.