Re: [go-nuts] syscall/js documentation missing

2021-06-21 Thread Tor Langballe
Ah, OK, thanks.
Would be great if the documentation showed what OS/ARCH one was browsing.
I didn't know about this functionallity, but very useful!

On Friday, June 18, 2021 at 11:34:55 p.m. UTC+2 axel.wa...@googlemail.com 
wrote:

> I guess you have to specify GOOS/GOARCH to a combination that actually has 
> API defined now:
> https://golang.org/pkg/syscall/js/?GOOS=js=wasm
>
> On Fri, Jun 18, 2021 at 11:28 PM Tor Langballe  
> wrote:
>
>> Is anyone else seeing this?
>>
>> https://golang.org/pkg/syscall/js/
>>
>> shows just a header paragraph about it being experimental.
>> All the api documentation seems to be gone.
>>
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/f00f1eff-c952-4de4-9cb8-0a4702c898e7n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/f00f1eff-c952-4de4-9cb8-0a4702c898e7n%40googlegroups.com?utm_medium=email_source=footer>
>> .
>>
>

-- 
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/ac414b7e-ca7b-4788-9968-1e8f2cd4062bn%40googlegroups.com.


[go-nuts] syscall/js documentation missing

2021-06-18 Thread Tor Langballe
Is anyone else seeing this?

https://golang.org/pkg/syscall/js/

shows just a header paragraph about it being experimental.
All the api documentation seems to be gone.


-- 
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/f00f1eff-c952-4de4-9cb8-0a4702c898e7n%40googlegroups.com.


Re: [go-nuts] [generics] generic function definition all in one parameter list

2020-07-21 Thread Tor Langballe
For constraints they also could be after type name:

func IndexOf(slice []type T comparable, find T) int
or maybe this is clearer:
func IndexOf(slice []type comparable T, find T) int

This generic type information could be added on leftmost first use of the 
type in the parameter list or return, and only the type name (i.e T) used 
if more than once as above.
Multiple type parameters should be just doing this for each parameter:

func IndexOf(slice []type T, find T, range type R) int

types used only in the function but not as a parameter could have an 
underscore _ as their parameter name, not great, but workable for an edgy 
case perhaps.


It might have too many problems, but funny how introducing the "type" 
keyword opens up new possibilities!


On Wednesday, 22 July 2020 00:59:18 UTC+2, Ian Lance Taylor wrote:
>
> A few quick notes. 
>
> As you mention, how do constraints work? 
>
> If there are multiple type parameters, I think it's not immediately 
> obvious how the type arguments should be passed. 
>
> What about functions that use a type parameter that is not used by any 
> of the non-type parameters?  That's uncommon but it seems like it 
> could happen. 
>
> 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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0d9fd0f4-6531-433b-afe9-744c260b83b6o%40googlegroups.com.


[go-nuts] [generics] generic function definition all in one parameter list

2020-07-21 Thread Tor Langballe
This might have been discussed, but can't find anything about so easy, 
joined late...

Could generic function definitions be done all in one paramter list using 
the type keyword?

func IndexOf(slice []type T, find type T) int

or
func IndexOf(slice []type T, find T) int



instead of

func IndexOf[type T](slice []T, find T) int 


 
Function calling / instatiating would probably still have a type 
declaration part in [ ] or whatever ends up being used.

It could get messy with contracts / required interfaces, and might not be 
parsable, but might be nice not to repeat types if they are longer names.

 



-- 
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/0e923dcd-27f7-4973-bcde-ee9dadcb3de2o%40googlegroups.com.


[go-nuts] Re: Generics and parentheses

2020-07-18 Thread Tor Langballe
The square bracket has a bit of history in go already, as a key-type 
specifier for the somwhat generics-like map declaration;

since we already do 

var map[int]string 

it feels a bit natural to specify types in square brackets to me.

-- 
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/6ea40e8b-9b1b-4e02-87bb-f60fd3e4416ao%40googlegroups.com.


[go-nuts] Re: ticker not firing often enough in minimal mac app with run loop

2019-09-05 Thread Tor Langballe
Thanks for all the replies everybody!

id activity = [[NSProcessInfo 
processInfo] beginActivityWithOptions:NSActivityBackground reason:@"Good 
Reason"]; 
*Seems to do the trick*, and cpu usage stays at 0.01%

I tried using sudo nice -1 and even -20, the cpu usage went up from 0.01 to 
0.1, but I still got the big pauses, I guess it still puts the app to sleep 
when it thinks it isn't doing anything, even if it gets more CPU when it's 
not sleeping.

tor


-- 
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/c2e7d85a-dd86-4fd7-b2c8-e52d6fd5b712%40googlegroups.com.


[go-nuts] ticker not firing often enough in minimal mac app with run loop

2019-09-04 Thread Tor Langballe
I'm running a mac cocoa event loop, and calling a go ticker:

void StartApp() {
[NSAutoreleasePool new];
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp run];
}

func test() {
 last := time.Now()
 ticker := time.NewTicker(time.Second)
 for range ticker.C {
 t := time.Now()
 diff := t.Sub(last)
 if diff > time.Second*2 {
 fmt.Println("Tick slow:", diff)
 }
 last = t
  }
}


func main() {
 go test()
 C.StartApp()
}

currenly just running the go program from the terminal, though I got 
similar results packaging it into an app.

I soon get very long periods between ticker fires:

Tick slow: 3.501350114s
Tick slow: 5.551485377s

This seems to only happen with 

[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];

NSApplicationActivationPolicyProhibited and 
NSApplicationActivationPolicyAccessory don't cause this.

I assume it's the event loop in [NSApp run] that is causing this, but don't 
know how to start making a mac appliction with goroutines and tickers that 
don't get blocked.

Does anybody know how to avoid this and why it is happening?

tor



-- 
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/62325cef-7441-4a7c-abf9-ff58454ff5f4%40googlegroups.com.