Thanks Robert, I've come to the same conclusion. I'm guessing the approach
simplifies and speeds up the escape analysis, though appears to be a
significant limitation.
The following extract from escape.go seems to apply.
https://tip.golang.org/src/cmd/compile/internal/escape/escape.go
// Ever
Yes, but the called function can retain a reference to the string - strings are pointers. it cannot retain a reference to the scalar. I’m guessing if any of the elements can be retained then the entire structure is allocated on the heap - I don’t think it has to but it is probably the current imple
Thanks Robert. I don't think it's the value that's causing thisI still
get the allocation if I remove the value from the equation. It's something
to do with the root level having children.
The escape analysis from the refactored code below is:
go build -gcflags='-m=2' .
./alloc.go:12:27: p
Thanks! That looks like a useful package.
On Friday, August 30, 2024 at 6:37:01 PM UTC+1 Ian Lance Taylor wrote:
> On Fri, Aug 30, 2024 at 10:33 AM costin wrote:
> >
> > Is there a way to concatenate 2 iterators (other than writing my own
> function)? There isn't any std function I could find.
On Fri, Aug 30, 2024 at 10:33 AM costin wrote:
>
> Is there a way to concatenate 2 iterators (other than writing my own
> function)? There isn't any std function I could find. Would such a function
> belong in the iter package (slices seems like the wrong place)?
It would probably start out in
Is there a way to concatenate 2 iterators (other than writing my own
function)? There isn't any std function I could find. Would such a function
belong in the iter package (slices seems like the wrong place)?
--
You received this message because you are subscribed to the Google Groups
"golang-
because when you only access an int that is passed by value in the function it
knows it can’t escape.
if you pass the string/value than the the variable can escape, and since the
value could point back to the struct itself, it can escape, meaning the entire
struct needs to be on the heap.
> O
Hi Everyone,
https://gist.github.com/rkerno/c875609bdeb2459582609da36b54bf72
I'm struggling to wrap my head around the root cause of this issue.
Accessing certain fields of a struct triggers go to allocate the complete
struct on the heap. The key ingredients are:
- A struct with a containe
I want to build an Application like Facebook.
Now, I've started using *Svelte* and *SvelteKit*, but I'm noticing quite
some level of complexity that wants to kill me.
So I thought to ask, "*How can I build a website 100% like Facebook with
GO"* ?
*React*, *Vue* and *Svelte* shined, and the mai
I like:
```go
func Iter(ctx, data) (iter.Seq[Object], *error)
```
There are some examples of this pattern in
https://pkg.go.dev/github.com/bobg/seqs
Cheers,
- Bob
On Thursday, August 29, 2024 at 5:41:47 AM UTC-7 Dmitriy P wrote:
> What is the best way to handle errors with iterators?
>
> How t
Hello gophers,
We plan to issue Go 1.23.1 and Go 1.22.7 during US business hours on Thursday,
September 5.
These minor releases include PRIVATE security fixes to the standard library and
the toolchain, covering the following CVEs:
- CVE-2024-34155
- CVE-2024-34156
- CVE-202
Mike,
Let's use official Go sources.
go/src/cmd/tools/tools.go:
$ go version
go version devel go1.24-0f003f9d15 Thu Aug 29 09:15:06 2024 +
linux/amd64
$
$ cat tools.go
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license t
Opinionated answer: If a container type cannot iterate over its elements
without fail, I would refrain from trying to build a standard iterator for
this container type. You'd be shoehorning an iterator that can fail into
the iter API that is not designed for dealing with errors.
Putting half-w
13 matches
Mail list logo