i am reading gc's code. i just need to know. reflect.TypeOf return a 
interface, the interface ref to a instance or call data. that instance 
should be generate by compiler. but i can not find where is the compiler 
code that generate data about type.

On Friday, August 14, 2020 at 7:00:19 PM UTC+8 xie cui wrote:

> the return instance of reflect.TypeOf(some object) should be generate by 
> compiler, the type info which could be in elf files. i want to known where 
> compiler generate it. 
>
> On Friday, August 14, 2020 at 5:08:30 PM UTC+8 Volker Dobler wrote:
>
>> On Friday, 14 August 2020 08:15:03 UTC+2, xie cui wrote:
>>>
>>>
>>> how can i see the code genrate by compiler, and where is the compiler 
>>> code to generate these code(which file, which function). i am just curious.
>>
>>
>> Can you explain what you mean exactly by "code generated by the compiler"?
>> Are  you interested in the assembly? https://golang.org/doc/asm ?
>> The compiler sources are in
>> https://github.com/golang/go/tree/master/src/cmd/compile/internal/gc
>> and there is no single file/function which compiles package reflect.
>>
>> This really sound like a XY problem.
>>
>> V.
>>
>>  
>>
>>> On Friday, August 14, 2020 at 1:32:25 PM UTC+8 Volker Dobler wrote:
>>>
>>>> The value returned by reflect.TypeOf is not computed during
>>>> compile time but during run time. The code for package
>>>> reflect is generated by the compiler during compile time
>>>> but this is not interesting to understand reflection at all as
>>>> it is the same code generation like for lets say net/http.
>>>>
>>>> The source code for package reflect is open source, just
>>>> have a look. Note that https://golang.org/pkg/reflect/#TypeOf
>>>> links directly to the source code.
>>>>
>>>> Understanding of reflection does not happen by studing
>>>> the compiler and not the implementation of package reflect
>>>> but by reading the appropriate blog post on blog.golang.org.
>>>>
>>>> V.
>>>>
>>>>
>>>> On Friday, 14 August 2020 04:44:57 UTC+2, xie cui wrote:
>>>>>
>>>>>
>>>>> the return of reflect.TypeOf should be generate by compile, i am 
>>>>> trying to understand it, so i need to know where is code generate it in 
>>>>> compiler. i need to know compiler parts. and i am curious about what is 
>>>>> do 
>>>>> in user code also.  please tell me about it. i will be appriciated.
>>>>> On Thursday, August 13, 2020 at 10:47:28 PM UTC+8 Jan Mercl wrote:
>>>>>
>>>>>> On Thu, Aug 13, 2020 at 3:53 PM xie cui <cuiw...@gmail.com> wrote: 
>>>>>>
>>>>>> > ..., i know this type struct in generate by compiler, and i need to 
>>>>>> know where is this code, and how to generate the struct fields and 
>>>>>> methods? 
>>>>>>
>>>>>> To avoid the possibility of the XY problem, can you please tell more 
>>>>>> about the goal of "generating struct fields and methods" and what 
>>>>>> exactly is meant by that? Some things can be done by the compiler, 
>>>>>> some in user code and the two feature sets are definitely not the 
>>>>>> same. 
>>>>>>
>>>>>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/74aa85e3-7eb2-472b-a51b-a780a702487cn%40googlegroups.com.

Reply via email to