On Sat, Apr 2, 2022 at 2:46 PM Kalen Krempely wrote:
>
> 2) As a follow up question I find it weird that VerifyDir needs to take in
> both a filesystem and the root path. (ie: `VerifyDir(fsys fs.FS, dir
> string)`) That is, the calling code will be something like
> VerifyDir(os.DirFS("/some/pat
If I understand you right, you seem to want to use "<-" as the "compose" higher
order function but as an infix operator. That is, instead of "value :=
F(G(args...))", you want to be able to write "value := (F <- G)(args...)".
Further, "F <- G <- H" means "F <- (G <- H)". F, G &H are functions su
Thanks Ian for the reply!
*1)* I think I figured out what was going on. Basically, I need to pass the
root path to my verifyDir function and just have the fstest.MapFS contain
the sub elements, rather than the full paths.
That is, the example test code needs to be:
t.Run("some test", func(t *te
Yep. That’s the status quo. My tongue-in-cheek response to that as
objection is “If simply sufficient utility for a given task were valid as
objection to a new utility, why Go over C?” If you’re not posing that as
objection, no need to dwell on it.
Yeah. That’s exactly the kind of behavior I want
Hey all,
Congrats to the Go Team for shipping generics!
I was experimenting with a design for generics for a long time. I thought
I'd share it anyway for fun. I think it has some interesting (IMHO) aspects
and trade-offs compared to the design that shipped:
- Type variable declarations are
Ah, I forgot that point.
Thanks for the explanation!
On Saturday, April 2, 2022 at 10:00:27 PM UTC+8 axel.wa...@googlemail.com
wrote:
> Ptr[int] is a defined type, `*int` is not. So the two types are not the
> same and this is working as intended.
>
> On Sat, Apr 2, 2022 at 3:50 PM tapi...@gmai
Ptr[int] is a defined type, `*int` is not. So the two types are not the
same and this is working as intended.
On Sat, Apr 2, 2022 at 3:50 PM tapi...@gmail.com
wrote:
>
> package main
>
> type Ptr[E any] *E
>
> type MyConstraint interface {
> Ptr[int]
> }
>
> type YourConstraint interface {
>
package main
type Ptr[E any] *E
type MyConstraint interface {
Ptr[int]
}
type YourConstraint interface {
*int
}
func foo[T MyConstraint](x T) {
}
func bar[T YourConstraint](x T) {
}
func main() {
var x = new(int)
foo(x) // *int does not implement MyConstraint
bar(x)
}
--
Correct repository path is: https://github.com/jackc/pgtype
Interesting. These structs generally contain a Status value as well:
type Int8 struct {
Int int64
Status Status
}
where pgtype.go has:
type Status byte
const (
Undefined Status = iota
Null
Present
)
They also have Set