text
stringlengths
0
2.35k
[2186.60 --> 2188.52] they just get taken out by the compiler
[2188.52 --> 2190.24] because there are things for humans,
[2190.34 --> 2191.42] there are no things for CPUs,
[2191.44 --> 2192.66] and so they have no place
[2192.66 --> 2193.84] in your compiler program.
[2194.34 --> 2195.32] Yeah, that's a great point.
[2195.78 --> 2197.10] Actually, one callback
[2197.10 --> 2198.98] from one question you asked earlier,
[2199.20 --> 2200.86] you asked how many different things
[2200.86 --> 2201.80] can a compiler do
[2201.80 --> 2202.84] when it comes to different languages?
[2203.52 --> 2204.46] An additional example
[2204.46 --> 2205.22] I can give for Go
[2205.22 --> 2207.38] is Go programs, Go functions,
[2207.50 --> 2208.86] they can return any number
[2208.86 --> 2210.78] of return values, right?
[2211.36 --> 2212.34] This is not something
[2212.34 --> 2214.00] that most languages are doing.
[2214.20 --> 2214.98] And so when you look
[2214.98 --> 2215.94] at the assembly language,
[2215.94 --> 2217.32] then at the end of the day,
[2217.42 --> 2219.00] it turns out to be translated
[2219.00 --> 2220.24] in CPU code
[2220.24 --> 2222.32] in very different ways
[2222.32 --> 2223.88] than normal functions
[2223.88 --> 2225.48] are supposed to work, right?
[2225.68 --> 2226.56] When you have a function
[2226.56 --> 2227.70] that can only return
[2227.70 --> 2228.58] single arguments,
[2228.82 --> 2229.74] which is the case
[2229.74 --> 2231.28] for a lot of languages out there,
[2231.36 --> 2232.50] like CC++, etc.,
[2232.50 --> 2234.06] then you have a very simple convention.
[2234.20 --> 2235.00] The convention says,
[2235.18 --> 2236.24] oh, the return value
[2236.24 --> 2237.78] will be in register EAX
[2237.78 --> 2238.30] in assembly.
[2238.42 --> 2239.90] This is the rule.
[2240.26 --> 2240.94] It's very simple.
[2241.48 --> 2242.64] When it comes to Go language,
[2242.82 --> 2244.36] then you don't have
[2244.36 --> 2245.10] a single place
[2245.10 --> 2245.88] because you can have
[2245.88 --> 2246.62] several arguments.
[2246.78 --> 2247.64] And so they are returned
[2247.64 --> 2249.48] differently through the stack
[2249.48 --> 2250.30] and you have to go
[2250.30 --> 2251.00] look for it there.
[2251.08 --> 2252.70] It's just much more complex
[2252.70 --> 2253.78] and it's very different
[2253.78 --> 2255.24] from a traditional language.
[2255.80 --> 2256.88] And the difference
[2256.88 --> 2257.64] between the languages
[2257.64 --> 2258.24] are going to be
[2258.24 --> 2259.60] small things like this
[2259.60 --> 2261.06] when it comes to conventions,
[2261.26 --> 2262.38] but actually,
[2262.66 --> 2263.86] some of all of them
[2263.86 --> 2264.84] are going to result
[2264.84 --> 2265.98] in having a source code
[2265.98 --> 2267.08] or an assembly code
[2267.08 --> 2268.10] at the end of the day
[2268.10 --> 2269.26] that is really
[2269.26 --> 2270.56] extremely different
[2270.56 --> 2271.32] from one another.
[2271.32 --> 2272.54] Would you say that
[2272.54 --> 2272.98] the way,
[2273.18 --> 2273.88] from what you see,
[2273.98 --> 2275.50] the way that Go handles
[2275.50 --> 2276.94] on the compiler level,
[2277.04 --> 2278.86] the return of multiple arguments
[2278.86 --> 2280.46] is efficient overall?
[2280.92 --> 2281.16] Yeah,
[2281.26 --> 2282.50] it really feels like it
[2282.50 --> 2283.54] as far as I recall.
[2283.90 --> 2284.56] Like maybe this is
[2284.56 --> 2285.64] me making a mistake,
[2286.04 --> 2287.22] but it feels like
[2287.22 --> 2288.10] the return values
[2288.10 --> 2289.26] from one function call
[2289.26 --> 2290.26] are placed exactly
[2290.26 --> 2290.94] where they should be
[2290.94 --> 2291.42] on the stack
[2291.42 --> 2292.98] so that another function
[2292.98 --> 2293.90] can use them
[2293.90 --> 2294.88] as arguments immediately.
[2295.42 --> 2296.56] And so chain the calls
[2296.56 --> 2297.80] between different functions
[2297.80 --> 2298.28] when you have
[2298.28 --> 2299.88] a function calling.
[2299.88 --> 2301.16] When you call a function
[2301.16 --> 2302.42] by passing an argument
[2302.42 --> 2303.74] which is the result
[2303.74 --> 2304.72] of another function call,
[2304.96 --> 2305.50] it feels like
[2305.50 --> 2306.66] in assembly
[2306.66 --> 2308.18] that these function calls
[2308.18 --> 2308.76] are going to be
[2308.76 --> 2310.24] very close to each other.
[2310.32 --> 2311.08] You won't have to