by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 04:09
    krader1961 commented #1079
  • 04:00
    krader1961 commented #1079
  • 03:42
    krader1961 synchronize #1079
  • Aug 05 09:36
    raetiacorvus synchronize #1081
  • Aug 05 09:35
    raetiacorvus synchronize #1081
  • Aug 05 03:06
    krader1961 synchronize #1079
  • Aug 05 02:41
    krader1961 commented #1079
  • Aug 05 02:22
    krader1961 opened #1093
  • Aug 04 22:08

    xiaq on master

    Document `break`, `continue`, a… (compare)

  • Aug 04 22:08
    xiaq closed #1082
  • Aug 04 22:06
    xiaq commented #1079
  • Aug 04 05:02
    krader1961 commented #1092
  • Aug 04 04:44
    krader1961 commented #1092
  • Aug 04 04:40
    krader1961 opened #1092
  • Aug 03 05:50
    krader1961 opened #1091
  • Aug 03 05:32
    krader1961 opened #1090
  • Aug 03 04:23
    krader1961 commented #126
  • Aug 02 05:46
    krader1961 commented #1079
  • Aug 02 04:43
    krader1961 synchronize #1082
  • Aug 02 04:33
    krader1961 synchronize #1082
kolbycrouch
@kolbycrouch
Also I should've worded myself more carefully, I should have said "serious performance implications" :D
mesajor
@mesajor
[hhanche(telegram)] Personally, I think for {key value} $map would be more useful. (re @mesajorbot: [krader1961(gitter)] I don’t know why Xiaq chose, apparently deliberately, to disallow constructs like for key $map while allowing for val $list.)
mesajor
@mesajor
[zzamboni(telegram)] @hhanche inspried by your with-stty function, I started a new module: https://github.com/zzamboni/elvish-modules/blob/master/tty.org
[zzamboni(telegram)] (unrelated question: I updated my GitHub avatar months ago, but the previews produced by Telegram still have the old one - anyone knows how to force a refresh?)
mesajor
@mesajor
[hhanche(telegram)] 👍🏻 (re @zzamboni: @hhanche inspried by your with-stty function, I started a new module: https://github.com/zzamboni/elvish-modules/blob/master/tty.org)
kolbycrouch
@kolbycrouch
@hhanche I like the idea of for k v $map as well.
mesajor
@mesajor
[xiaqqaix(telegram)] I like “for [k v] $map”, but as a prerequisite elvish needs to support destructuring assignment
Kurtis Rader
@krader1961
Yay! The hosted goreportcard report for Elvish now has fewer spurious errors. See gojp/goreportcard#324.
mesajor
@mesajor
[xiaqqaix(telegram)] I don’t like the fact that in some languages iterating through a map gives you keys; I always had to look up whether it’s keys or values that’s produced
[xiaqqaix(telegram)] @krader1971 Nice, thanks for reporting it to goreportcard
[xiaqqaix(telegram)] Plus, getting keys from map iteration is inconsistent with list iteration, which yields values, not indices
Kurtis Rader
@krader1961
True but until something like for [k v] $map works it obviously makes more sense for the iteration to yield keys than values. Whether that should be implemented as a stepping stone is debatable.
kolbycrouch
@kolbycrouch
@xiaq Maybe requiring both a key and value variable in for loops would simplify that? For every k key found v would represent the value.
mesajor
@mesajor
[xiaqqaix(telegram)] I think a better stepping stone is to yield pairs, e.g. "for p [&a=b] ..." assigns p to [a b]
Kurtis Rader
@krader1961
SGTM
mesajor
@mesajor
[xiaqqaix(telegram)] This is in fact orthogonal with destructuring assignment
kolbycrouch
@kolbycrouch
This is gonna sound like a stupid question, but I was messing around and noticed something odd to me. When I do something like this for i := 0; i < 1000000000; i++ {} in GO, it finishes on my machine in about 1 second. When I do i = 0; for x [(range 0 1000000001)] { i = (+ $i 1) } in Elvish, it horribly slow. Seems like it would take hours if not days to finish. I figured it would be a big difference because of compiled vs. interpreted, but not this big. Converting everything to float64 wouldn't cause that much of a difference would it?
Kurtis Rader
@krader1961
No, explicitly converting the values using float64 won't help. There are a few reasons why Elvish is slower. Starting with the obvious: The Go program is compiled to machine instructions while the Elvish program is executed by what amounts to a VM.
Another significant difference is your Elvish version is constructing a huge array. That is going to be expensive.
kolbycrouch
@kolbycrouch
I meant converting all numbers to float64 internally, or at least I thought that's what elvish does. doing something like while (not-eq $i (float64 1000000001)) { i = (+ $i 1) } is also incredibly slow.
I just noticed that my list using range actually blows up before 1 billion. I was comparing that with while using smaller values and time. I waited a few hours with the while version to complete to no avail.
Kurtis Rader
@krader1961
Your Elvish version is not idiomatic Elvish. Probably the fastest Elvish equivalent of your simple Go loop is this: range 0 1000001 | each [x]{ }. That loop is 1000 times smaller than yours and takes 2.6 seconds on my laptop. So ~0.7 hours if I ran it with your original range.
Note that the first time you use the + operator i is a float64.
And doing < $i 1000000001 will convert the constant to a float64 implicitly so there doing it explicitly won't help and will probably be slightly slower due to the need to introduce another output capture.
Kurtis Rader
@krader1961
Fun fact: You can embed underscores in number literals. When I updated the https://elv.sh/ref/language.html#number documentation a while back I documented the new prefixes (e.g., 0x, 0o, 0b) but neglected to document that number literals can also contain underscores for readability; e.g., 1_000_000_001 from the earlier discussion.
mesajor
@mesajor
[hhanche(telegram)] Is that a feature of the go library used to parse numbers, or is it special to elvish?
Kurtis Rader
@krader1961
It's a feature added to Go 1.13.
mesajor
@mesajor
[Kingsy(irc)] 1/j web
mesajor
@mesajor
[pontaoski(telegram)] is there any common coding pattern for implementing the command w/ subcommands pattern in elvish?
mesajor
@mesajor
[zzamboni(telegram)] Not that I know of, but it occurs to me you could have a map of maps with the corresponding lambdas.
mesajor
@mesajor
[xiaqqaix(telegram)] Or you could just put multiple functions in a module. mod:func isn't that different from "cmd subcmd".
[zzamboni(telegram)] That's what I do 😉
[xiaqqaix(telegram)] In fact, the subcommand pattern is just a way to namespace commands. Elvish has modules for that.
[zzamboni(telegram)] I even suggested allowing the separation with a space once, some time ago: elves/elvish#501
[zzamboni(telegram)] (I agree not a good idea BTW)
kolbycrouch
@kolbycrouch
@krader1961 After looking at my PR #1084, should I commit the changes to that PR, or open a new one? I have the appropriate changes ready I think, just not sure how to go about sending them in.
Kurtis Rader
@krader1961
@kolbycrouch, I don’t understand what you mean by “should I … open a new one?” If you have made changes to an existing PR you should simply push those changes upstream. It might be appropriate to squash the changes on your side and do a git push -f.
Since this is your first, non-trivial, change to the Elvish project you should expect a lot of feedback requeuesting modifications to your proposed change.
kolbycrouch
@kolbycrouch
@krader1961 I meant should I open a new one instead of committing more to the branch associated to the PR. Squashing the changes is what I kinda assumed I should do, but I wasn't sure. Yea, I expected feedback. Most of the problems are me being short-sighted.
Btw, is there something in the testing framework that allows me to choose a test on the condition of which OS the test is being ran on? The failed test on windows was hard for me to see coming, and I wasn't entirely sure how to remedy it without tossing out the offending test.
mesajor
@mesajor
[cwopel(telegram)] @kolbycrouch No need to open a new PR, just force push the changes to your branch or squash the commits after like @krader1961 said.
Kurtis Rader
@krader1961
@kolbycrouch, Regarding platform specific tests you can put lines like this, // +build !windows,!plan9,!js, at the top of a source file to control which platforms it is compiled on. See, for example, the files in pkg/eval/unix.
mesajor
@mesajor
[shaunak1508(telegram)] 4
[shaunak1508(telegram)] Please check out my harmonica cover of the Elvis Song, Can't Help Falling in Love:
https://youtu.be/81eD0BzE98M
[zzamboni(telegram)] @shaunak1508 wrong group, this is about the Elvish shell, not Elvis
[mueslix(telegram)] 😂
mesajor
@mesajor
[thegrizzlysmit(telegram)] Lol 😂 🤣 😜
mesajor
@mesajor
[Kingsy(irc)] zzamboni, have you noticed the bash_completion stuff has stopped working? ssh completion etc? ermm I might be crzy but I am sure you wrote that? Or perhaps I just found it somewhere.
[Kingsy(irc)] havent had a chance to debug it yet. but I thought you might know
mesajor
@mesajor
[zzamboni(telegram)] @Kingsy: I have not noticed anything broken recently. Can you give me some specific examples? Also, have you updated the modules recently with epm:upgrade?