profile
viewpoint
Matthew Dempsky mdempsky @google San Francisco, CA I eat plants and write Go.

mdempsky/gocode 808

An autocompletion daemon for the Go programming language

jasperla/openbsd-wip 206

OpenBSD work in progress ports

mdempsky/dnscurve 35

Tools for DNS curve implementation

mdempsky/grbl 2

An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino

dxe/dxesf-docs 1

DxE SF Bay Area Documents

mdempsky/flutter_buildroot 1

Build environment for the Flutter engine

mdempsky/go 1

The Go programming language

pull request commentachlipala/frap

`Declare Scope` is new as of 8.10

For what it's worth, it seems like most Linux distributions are currently still distributing Coq 8.9:

  • https://packages.debian.org/search?keywords=coq&searchon=names&suite=all&section=all
  • https://packages.ubuntu.com/search?keywords=coq&searchon=names
  • https://apps.fedoraproject.org/packages/coq
  • https://packages.gentoo.org/packages/sci-mathematics/coq

Arch Linux seems like the notable exception that I could find offering 8.11:

  • https://www.archlinux.org/packages/community/x86_64/coq/

OpenBSD and NetBSD have 8.10:

  • https://openports.se/math/coq
  • http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/coq/Makefile

FreeBSD has 8.6:

  • https://www.freshports.org/math/coq

--

My 2c: As a casual learner without ocaml/opam-familiarity, I've found it handy to just use the Debian/Fedora-supplied Coq packages. But the Install Coq with opam instructions don't look too daunting if it came down to that.

andres-erbsen

comment created time in 12 hours

issue commentgolang/go

runtime: emit better errors from checkptr

All good points. I'm open to improving the error messages.

Some suggestions:

checkptr: misaligned pointer conversion
checkptr: converted pointer straddles multiple allocations
checkptr: pointer arithmetic computed bad pointer value
checkptr: pointer arithmetic result points to invalid allocation

I'm also wondering if "checkptr:" should change to "unsafe:" for consistency with warnings about packages runtime and sync, or if it should stay "checkptr" to make the compiler flag connection clearer.

dominikh

comment created time in a day

push eventdxe/adb

Matthew Dempsky

commit sha 0708c8ddd1c0c64b685f0442c2b120487b2c9356

fix for MySQL's dumb-typing rules

view details

push time in 3 days

push eventdxe/adb

Matthew Dempsky

commit sha a75b682125266da6709e9c77275c28c1fe70baae

fix json data struct declaration

view details

push time in 3 days

push eventdxe/adb

Matthew Dempsky

commit sha c19f4bffc375fc4e0efae709d41c9a357aaa3a05

update voter eligibility for March

view details

push time in 3 days

issue commentgolang/go

reflect: Select panics if array length greater than 1<<16

If we want to bump up the 1<<16 limit, we'll also be to bump up the type uint16. That will then increase stack usage by all functions that contain select statements.

Not a big deal, but wanted to make sure it's clear that 1<<16 here isn't an arbitrary restriction.

theMPatel

comment created time in 7 days

push eventdxe/adb

Matthew Dempsky

commit sha 17a3af8d53081627b1daab9f35c63a481dd93a32

relax SameSite further for members.dxesf.org

view details

push time in 8 days

push eventdxe/adb

Matthew Dempsky

commit sha a8c01f9d644d55da60b8324aa7bb4b2918017366

relax SameSite requirement on members.dxesf.org "state" cookie This cookie needs to be accessible when redirecting from the Google OAuth page, so it can't be strict. While here, also bump up the cookies to "HttpOnly".

view details

push time in 8 days

issue commentejgallego/jscoq

x80.org SSL certificate just expired

No apology needed. Just wanted to make sure you were aware. :)

mdempsky

comment created time in 8 days

issue openedejgallego/jscoq

x80.org SSL certificate just expired

Trying to visit https://x80.org/rhino-coq/v8.11/examples/lf/ gives me an SSL error, because the SSL certificate expired about an hour ago. :(

created time in 8 days

issue openedurweb/urweb

Funny spacing in generated .sql files

It looks like the SQL printer is increasing the indentation level during CREATE SEQUENCE and CREATE TABLE statements, but then failing to reset it fully:

matthew@bento:~/wd/urweb/demo$ urweb chat
matthew@bento:~/wd/urweb/demo$ cat chat.sql; echo '<<EOF>>'
CREATE SEQUENCE uw_Chat_Room_s;
 
 CREATE TABLE uw_Chat_Room_t(uw_id int8 NOT NULL, uw_client int4 NOT NULL, 
                              uw_channel int8 NOT NULL,
  CONSTRAINT uw_Chat_Room_t_pkey PRIMARY KEY (uw_client, uw_id)
   
  );
  
  CREATE SEQUENCE uw_Chat_s;
   
   CREATE TABLE uw_Chat_t(uw_id int8 NOT NULL, uw_title text NOT NULL, 
                           uw_room int8 NOT NULL,
    CONSTRAINT uw_Chat_t_pkey PRIMARY KEY (uw_id)
     
    );
    
    <<EOF>>

created time in 9 days

pull request commentdxe/adb

add SameSite=Strict attribute to cookies

Nice.

mdempsky

comment created time in 9 days

PR opened dxe/adb

Reviewers
add SameSite=Strict attribute to cookies

Updates #26.

+22 -16

0 comment

2 changed files

pr created time in 9 days

create barnchmdempsky/adb

branch : samesite

created branch time in 9 days

issue commentgolang/go

x/tools/internal/fastwalk: "checkptr: unsafe pointer conversion" during darwin race test

Looks like the problem is this conversion at https://github.com/golang/tools/blob/b320d3a0f5a29dea7f95f1ca5c4cbef0ac24a304/internal/fastwalk/fastwalk_unix.go#L80:

	dirent := (*syscall.Dirent)(unsafe.Pointer(&buf[0]))

On Darwin, syscall.Dirent's size is >1000 bytes (https://golang.org/pkg/syscall/?GOOS=darwin#Dirent), but I'm guessing buf here is smaller than that.

Easiest fix would be to change it to:

        var dirent syscall.Dirent
        copy((*[unsafe.Sizeof(dirent)]byte)(unsafe.Pointer(&dirent))[:], buf)
leitzler

comment created time in 10 days

issue openedurweb/urweb

Why do guarded types use "=>" instead of "->"?

The type of expression fn [c ~ c] => e is written [c ~ c] => t. Why isn't it [c ~ c] -> t?

This seems inconsistent with everywhere else that -> is used as the type of a => expression, and I haven't found any explanation for it.

I briefly played around with adding an extra rule to the yacc grammar to allow [c ~ c] -> t, and it seemed to work okay without introducing any new conflicts or parser problems.

Not a huge issue, but it kept confusing me why folder type signatures included both -> and =>. I thought I was missing something (deeper than notation), especially since I haven't found any documentation that explicitly called out the inconsistency.

created time in 10 days

push eventmdempsky/dxesf-docs

Matthew Dempsky

commit sha 7f43710387bb1c9b0ba8998ed61ded3008dcd0f7

Animal Care voting requirement amendment

view details

push time in 10 days

PR closed dxe/dxesf-docs

change Chapter Meeting to quarterly

Moved by Paul P.

+2 -2

1 comment

1 changed file

mdempsky

pr closed time in 10 days

pull request commentdxe/dxesf-docs

change Chapter Meeting to quarterly

Withdrawn.

mdempsky

comment created time in 10 days

PR opened dxe/dxesf-docs

Animal Care voting requirement amendment
+5 -1

0 comment

1 changed file

pr created time in 10 days

create barnchmdempsky/dxesf-docs

branch : animalcare

created branch time in 10 days

push eventdxe/dxesf-docs

Matthew Dempsky

commit sha 9a6139b159da434e9fcbc3ae966373c480026b61

add Feb 2020 election ballots

view details

push time in 11 days

PR merged dxe/dxesf-docs

add Feb 2020 election ballots
+41 -0

0 comment

1 changed file

mdempsky

pr closed time in 11 days

PR opened dxe/dxesf-docs

add Feb 2020 election ballots
+41 -0

0 comment

1 changed file

pr created time in 11 days

create barnchmdempsky/dxesf-docs

branch : feb2020-election

created branch time in 11 days

issue commentgolang/go

cmd/compile: error has incorrect column number

Thanks, for confirming. That's consistent with the issue I was describing.

quackenbush

comment created time in 16 days

issue commentgolang/go

cmd/compile: error has incorrect column number

Yeah, this is a known issue of the Go compiler's AST that we don't have precise column information for identifier use locations. I can't find an issue that captures this though.

A while back I tried preparing https://go-review.googlesource.com/c/go/+/38735 to fix this, but it had a non-negligible compiler performance impact (~4% for go/types and cmd/compile).

quackenbush

comment created time in 16 days

PR opened urweb/urweb

Manual edits

Some typos I noticed while studying Ur's static semantics.

+7 -7

0 comment

1 changed file

pr created time in 23 days

create barnchmdempsky/urweb

branch : manual-edits

created branch time in 23 days

delete branch mdempsky/urweb

delete branch : manual-typo

delete time in 23 days

delete branch mdempsky/urweb

delete branch : monad-kind

delete time in 23 days

delete branch mdempsky/urweb

delete branch : manual-tweaks

delete time in 23 days

delete branch mdempsky/urweb

delete branch : manual-nits

delete time in 23 days

create barnchmdempsky/urweb

branch : manual-nits

created branch time in 23 days

CommitCommentEvent

push eventdxe/adb

Matthew Dempsky

commit sha c740a4456778d282aa855b3f94929eafe1ef4f9b

Remove self-nomination link

view details

push time in a month

issue commentgolang/go

net: cannot resolve SRV records from Samba's DNS server

Okay, reverting that CL seems fine to me then once the trees open up again for development. Thanks.

PaulForgey

comment created time in a month

issue commentgolang/go

net: cannot resolve SRV records from Samba's DNS server

Ah, thanks. That looks safe to revert.

I'd appreciate some confirmation that other major DNS clients are today accepting SRV RRs. (I assume they are, otherwise I'd expect more pushback against Samba doing this.)

PaulForgey

comment created time in a month

issue commentgolang/go

net: cannot resolve SRV records from Samba's DNS server

Commit 24dd3780ca4f75fed9f321890729414a4b5d3f13 explicitly did this

I don't see that commit in Go's git history?

PaulForgey

comment created time in a month

issue commentgolang/go

net: cannot resolve SRV records from Samba's DNS server

RFC 2782 clearly states "name compression is not to be used for [SRV's Target] field."

RFC 3597 though states we "SHOULD" support decompressing names in SRV RRs (as opposed to "MUST" for the RRs where we already support decompression).

I'd review a patch to enable decompression (but not compression) of SRV targets if someone wants to work on one. I think Samba should fix their behavior though.

PaulForgey

comment created time in a month

issue openedgolang/go

cmd/link: trailing padding after "Go" in elf note

https://www.sco.com/developers/gabi/latest/ch5.pheader.html#note_section says [emphasis added]:

namesz and name
The first namesz bytes in name contain a null-terminated character representation of the entry's owner or originator. There is no formal mechanism for avoiding name conflicts. By convention, vendors use their own name, such as XYZ Computer Company, as the identifier. If no name is present, namesz contains 0. Padding is present, if necessary, to ensure 8 or 4-byte alignment for the descriptor (depending on whether the file is a 64-bit or 32-bit object). Such padding is not included in namesz.

It looks like we get this right for the "NetBSD" tag, where we include a single nul-terminator character within the name (as measured by namesz), but then include an extra padding zero-byte for alignment.

However, for the "Go" tag, we include an extra nul-terminator within the name itself. The second nul-terminator should actually be padding.

Pointed out by Mark Kettenis from OpenBSD.

/cc @4a6f656c

created time in a month

PR opened urweb/urweb

Manual tweaks
+6 -6

0 comment

1 changed file

pr created time in a month

create barnchmdempsky/urweb

branch : manual-tweaks

created branch time in a month

startedachlipala/frap

started time in a month

PR opened urweb/urweb

monad has kind (Type->Type)->Type, not just Type->Type
+1 -1

0 comment

1 changed file

pr created time in a month

create barnchmdempsky/urweb

branch : monad-kind

created branch time in a month

PR opened urweb/urweb

Fix documentation typo

Cooperative threads run uninterrupted between context-switch points.

+1 -1

0 comment

1 changed file

pr created time in a month

create barnchmdempsky/urweb

branch : manual-typo

created branch time in a month

fork mdempsky/urweb

The Ur/Web programming language

http://www.impredicative.com/ur/

fork in a month

startedurweb/urweb

started time in a month

startedurweb/urweb

started time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 8ef8ca9a4614ec3301da5001486862e33a78df95

change voter eligibility link to 3.3 Organizers instead 3.4 MPI applies to election vote eligibility too, but is worded more generally to apply to all Chapter Members, and so might be confusing to non-Organizers wondering why they're not eligible to vote.

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 12a20459077846d5bccff0a8ad72cba376b0d261

nit: fix hyperlink/punctuation consistency

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 539d54711e63ff641fdf9c4a6063db54dfce3136

add link for self-nomination

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 2afdd0579ed5d5e688b07a580c04645a42208793

add ?email= query parameter for easier testing

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 788d8df195778e3ddf971fe24e51600746630af8

show election eligibility

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 1658c931ee1116a623d61456d7fd2581b2243d12

show working group membership

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 077edd0031b6f9f0d8eaf5e02dfe74fac5ae6de3

cleanup activist report slightly; implement MPI experiment for Jan/Feb

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha f5c644a2e0d03752380850477a52abc3f7147f6e

cleanup activist report slightly; implement MPI experiment for Jan/Feb

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 8017dd4215c0a701f8d23746d3156cdcf4c6f753

refactor members.dxesf.org to be easier to maintain

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha bf0053f86d7144d4b4d6415f0f00b4ce3f7389ec

refactor members.dxesf.org to be easier to maintain

view details

push time in a month

create barnchmdempsky/adb

branch : members-refactor

created branch time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 8c41d3cafdd08c2a35eaf31ac50de03e54f49fa4

fix re-login link

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha 1bc7f4154a5f487bc68c54da4916ec0fe8e55f17

fix month formatting; make local development easier again

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha a79fc4f9028a62ab8e143b2357fb16c5ed696e21

make HTML look nicer on mobile

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha d221c9ed7bdb4886a8b50cb10f77850f7b3fadd5

fix Dockerfile

view details

push time in a month

push eventdxe/adb

Matthew Dempsky

commit sha aac8022ffcfc9f5acd80022e073687054430e702

add membership portal

view details

push time in a month

issue closedgolang/go

cmd/compile: enable -d=checkptr as part of -race and/or -msan?

As discussed on golang-dev, the new -d=checkptr instrumentation is compatible with -race and -msan and likely cheaper than either of them (about the cost of two runtime.findObject calls per conversion involving unsafe.Pointer), so maybe it should just be enabled as one of those flags.

It would be easy to tweak cmd/compile to enable -d=checkptr by default when -race or -msan are specified, and then to still allow -race -d=checkptr=0 to turn it back off (i.e., race instrumentation without pointer checking). I can do that now so we get some extra usage testing of -d=checkptr (thanks to existing builders that use -race, etc), and then closer to release we can re-evaluate the best user experience?

/cc @aclements @bradfitz @rsc

closed time in 2 months

mdempsky

issue commentgolang/go

cmd/compile: enable -d=checkptr as part of -race and/or -msan?

Closing again since we've decided to use throw, and the change has been committed.

mdempsky

comment created time in 2 months

IssuesEvent

issue commentgolang/go

cmd/compile: enable -d=checkptr as part of -race and/or -msan?

(Reopening to make sure we resolve the panic vs throw question.)

mdempsky

comment created time in 2 months

issue commentgolang/go

cmd/compile: different behaviors between short and normal variable declarations

It looks like this is because dcl.go:variter emits N:N variable declaration+initialization statements as var v1 t; v1 = e1; var v2 t; v2 = e2; .... This is safe because newly declared variables don't come into scope until after the statement, and short variable declarations must always declare new variables, so we can always initialize them in order.

On the other hand, for v1, v2 := e1, e2 we only require at least one variable to be newly declared. If v1 or v2 is already within scope, then it might appear in the RHS, and we need to be more careful.

As @go101 points out, the discrepancy is still conforming to the Go spec, so it's not something we have to fix.

I suspect the easiest fix (assuming we think it's worth fixing) would be changing variter to emit a single OAS2 node instead of multiple OAS nodes. I'm a little nervous if this has any unintended consequences via n.Name.Defn, but I don't immediately spot anything.

Another question is if it has any effect on compiler performance or on compiled program performance. I haven't looked into these at all yet.

go101

comment created time in 2 months

issue commentgolang/go

language: go and gccgo has different behavior when returning multiple values

Yes right, but I mean the current var form seems not wait f(&x) evaluated before it does assignment, compile with -m -m:

Fair point, and I think that hints to me why the behavior is different between @go101 's test cases.

But it's also just an implementation detail. Compilers are allowed to freely reorder statements, as long as the program visible behavior is correct. Eg, assigning to y before the RHS is done evaluating is fine because y doesn't come into scope until after the RHS anyway.

xyproto

comment created time in 2 months

issue commentgolang/go

language: go and gccgo has different behavior when returning multiple values

@cuonglm The RHS has to be fully evaluated before any assignments happen to the LHS, but it's not specified whether x is evaluated before or after f(&x).

xyproto

comment created time in 2 months

issue closedgolang/go

language: go and gccgo has different behavior when returning multiple values

What version of Go are you using (go version)?

<pre> $ go version go version go1.13.5 linux/amd64 </pre>

And for gccgo:

<pre> $ go version go version go1.12.2 gccgo (GCC) 9.2.0 linux/amd64 </pre>

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Arch Linux on 64-bit x86

<details><summary><code>go env</code> Output</summary><br><pre> $ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/afr/.cache/go-build" GOENV="/home/afr/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/afr/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build475953563=/tmp/go-build -gno-record-gcc-switches" </pre></details>

What did you do?

In connection with simplebolt, I discovered that the test passed when running with go, but failed when running with gccgo. I shrunk it down to this small test case:

package main

import "fmt"

func wrap(f func() error) error {
	return f()
}

func check() (result string, err error) {
	result = "A"
	return result, wrap(func() error {
		result = "B"
		return nil
	})
}

func main() {
	if result, _ := check(); result == "A" {
		fmt.Println("Compiled with gccgo")
	} else {
		fmt.Println("Compiled with go")
	}
}

When running this, it outputs "Compiled with gccgo" when compiled with gccgo and "Compiled with go" when compiled with go.

Also available at play.golang.org

What did you expect to see?

I would expect to see the same output for both go and gccgo. I don't know which compilation is "correct".

What did you see instead?

Different output for go and gccgo.

closed time in 2 months

xyproto

issue commentgolang/go

language: go and gccgo has different behavior when returning multiple values

I'm going to go ahead and close as Working As Intended, since @ianlancetaylor and I are in agreement on that.

xyproto

comment created time in 2 months

issue commentgolang/go

language: go and gccgo has different behavior when returning multiple values

@go101 Your examples showing discrepancy between normal and short variable initialization are interesting and probably worth fixing, but I think would be best as a separate issue.

xyproto

comment created time in 2 months

issue commentgolang/go

language: go and gccgo has different behavior when returning multiple values

Given:

var result string
var err error
result, err = "A", func() error { result = "B"; return nil }()

I think the result is unambiguously "A": we evaluate the RHS fully before assigning to any values to the LHS. So the "A" assignment happens last and wins.

I think arguably the same logic should apply to return statements, and in the original test case gccgo is correct, while cmd/compile is wrong.

xyproto

comment created time in 2 months

issue openedsveltejs/svelte

Unified create/claim component construction

Currently compiling a component emits a lot of boring DOM mutation logic. For example, even the simple svelte.dev/repl hello world example (when hydration is enabled) emits:

		c() {
			h1 = element("h1");
			t0 = text("Hello ");
			t1 = text(name);
			t2 = text("!");
		},
		l(nodes) {
			h1 = claim_element(nodes, "H1", {});
			var h1_nodes = children(h1);
			t0 = claim_text(h1_nodes, "Hello ");
			t1 = claim_text(h1_nodes, name);
			t2 = claim_text(h1_nodes, "!");
			h1_nodes.forEach(detach);
		},
		m(target, anchor) {
			insert(target, h1, anchor);
			append(h1, t0);
			append(h1, t1);
			append(h1, t2);
		},

I think this could instead be compiled as something like:

	c(ctx) {
		h1 = element(ctx, "h1", {}, (h1_ctx) => {
			text(h1_ctx, "Hello ");
			text(h1_ctx, name);
			text(h1_ctx, "!");
		});
	},

The context variable ctx would allow abstracting away the normal create/mount mode (i.e., appending to target before anchor) or in rehydrate's claim/mount mode (i.e., appending to target, but trying to reuse its existing children).

The convention would be nodes would be immediately inserted into the DOM in the order they're constructed, so there's no separate append calls necessary. Also, in rehydrate mode, any leftover unclaimed nodes would be automatically detached, so there's no need for the h1_nodes.forEach(detach); call. Finally, because the text nodes are automatically appended to the DOM, there's no need to save them as t0/t1/t2 anymore. (h1 still needs to be saved to implement detach.)

For example, when compiling without rehydration support, element and text might be implemented something like:

function construct(fn, target, anchor) {
    const ctx = [target, archor];
    fn(ctx);
}
function emit(ctx, node) {
    const [target, anchor] = ctx;
    target.appendChild(node, anchor);
}

function element(ctx, name, attributes, children) {
    const node = document.createElement(name);
    set_attributes(node, attributes);
    construct(children, node);  // Recursively construct children with new context
    emit(ctx, node);
}
function text(ctx, data) {
    emit(ctx, document.createTextNode(data));
}

Alternatively, by simply tweaking construct and emit, we could defer DOM operations until all of a node's children have been constructed (i.e., more like the current separation of create/mount):

function construct(fn, target, anchor) {
    const ctx = [];
    fn(ctx);
    for (let child of ctx) {
        target.appendChild(child, anchor);
    }
}
function emit(ctx, node) {
    ctx.push(node);
}

I plan on experimenting with the feasibility of this approach and its impact on JS bundle size.

My main question is whether there's a need for the current separation between node construction and mounting. E.g., is it needed for animation or something? As far as I can tell, it doesn't seem needed.

Filing an issue to describe the idea in case anyone has feedback on it (e.g., further room for improvement, or issues I'm overlooking that might prevent this approach from working at all).

created time in 2 months

issue commentsveltejs/sapper

Initial rendering remove all nodes from server side rendering and then render them again

When re-hydrating a component, Svelte "claims" all of the child nodes that are still needed/wanted; removes all of the leftover unwanted nodes; and then re-appends the needed nodes to ensure they're in the correct order.

The flickering is because when breaking on DOM modifications, foo.appendChild(bar); is treated as first removing bar from the DOM and then re-inserting it into the DOM at the end of foo's child list.

The other aspect is that if you have a component X with children [A, B, C], because the component is mounted by re-appending the children, you'll visually see the nodes cycle around:

X.appendChild(A) => [B, C, A]  (A moved to the end)
X.appendChild(B) => [C, A, B]  (B moved to the end)
X.appendChild(C) => [A, B, C]  (C moved to the end)

This is a consequence of using the same generic mount implementation for both the rehydration process (i.e., after claiming) and for the normal component construction lifecycle (i.e., after createing).

I don't know enough about the browser paint cycle to know if this could ever actually be visible to a normal user (i.e., outside of debugging). But "fixing" it would probably require changing the Svelte compiler to emit a call like setChildren(X, [A, B, C]), which can then more intelligently check that X's children are exactly those three nodes in that order, and elide DOM operations when they're not necessary.

foisonocean

comment created time in 2 months

PR opened sveltejs/svelte-scroller

Update README.md for Svelte v3

The uncompiled component is now named just Scroller.svelte.

Also, remove the misleading text about index.mjs: it's not just more efficient to use Scroller.svelte, but svelte-scroller no longer even builds or distributes an index.js or index.mjs file.

+1 -1

0 comment

1 changed file

pr created time in 2 months

push eventmdempsky/svelte-scroller

Matthew Dempsky

commit sha 467fb269909e6074c3068f5321e8864489d782cd

Update README.md for Svelte v3 The uncompiled component is now named just `Scroller.svelte`. Also, remove the misleading text about `index.mjs`: it's not just more efficient to use `Scroller.svelte`, but svelte-scroller no longer even builds or distributes an `index.js` or `index.mjs` file.

view details

push time in 2 months

issue openedsveltejs/svelte

let-binding fails when multiple elements are assigned to the same slot

Describe the bug If two elements are assigned to the same slot, let bindings on the first element are syntactically accepted, but don't actually introduce any bindings.

To Reproduce https://svelte.dev/repl/193a784e481947979ee20f97a8fc8200?version=3.16.5

Expected behavior The output should be:

A X
X
X
B X

but instead it's

undefined X
X
X
B X

Alternatively, a compiler error would be acceptable.

Severity Low.

created time in 2 months

issue commentsveltejs/svelte

Hooks for granular HMR support

Why was this issue closed? Is there a better issue for tracking HMR support?

I ask because this issue is referenced in sapper-template: https://github.com/sveltejs/sapper-template/blob/23b93f2c12dd387de62385bfafdaa89cd5f90430/webpack.config.js#L27

It seems like either: (1) the issue should be re-opened; (2) sapper-template comments should be updated to refer to a different blocking issue or explanation; or (3) hot-reload should be re-enabled.

ekhaled

comment created time in 2 months

push eventdxe/adb

Matthew Dempsky

commit sha 60783b69972bd5597a3fe7dc04a5a8405d8b843a

refactor event filtering

view details

push time in 2 months

push eventdxe/adb

Matthew Dempsky

commit sha f384779e90f7394e545e156eb4b3a42018a5fc45

have Travis CI push to Docker Hub

view details

push time in 2 months

pull request commentsveltejs/svelte

site: clearer examples for <slot let:name>

For context, I found learning about this feature confusing. I'm used to "X=Y" means "set variable X to value Y". However "let:foo={bar}" actually means "declare variable 'bar' and set it to the value of property 'foo'". The examples didn't make this clear because "let:item={item}" confuses which instance of the identifier "item" does what. I had to copy the code into the REPL and play around with it to figure this out.

mdempsky

comment created time in 2 months

PR opened sveltejs/svelte

site: clearer examples for <slot let:name>

In the first example, "item" is used to describe three logically distinct objects: (1) the name of the slot's property; (2) the JS variable used within FancyList.svelte's {#each} block; and (3) the JS variable used within App.svelte. To make it clearer that these are three different objects, give them different names.

The second example can continue reusing the same name for all of the objects to demonstrate there's no collision between them. But we can also simplify the example to take further advantage of shorthand rules.

+5 -5

0 comment

1 changed file

pr created time in 2 months

create barnchmdempsky/svelte

branch : slot-let-docs

created branch time in 2 months

fork mdempsky/svelte

Cybernetically enhanced web apps

https://svelte.dev

fork in 2 months

pull request commentdxe/adb

integrate surveys into adb

Oh, you need to add another COPY line to the Dockerfile for the survey subdirectory. See models, mailinglist_sync, etc.

jakehobbs

comment created time in 2 months

Pull request review commentdxe/adb

integrate surveys into adb

+package survey_mailer++import (+	"log"+	"strings"+	"time"++	"github.com/dxe/adb/config"+	"github.com/dxe/adb/model"+	"github.com/jmoiron/sqlx"+	"github.com/sourcegraph/go-ses"+)++func sendMissingEmail(eventName string, attendees []string) {+	if len(attendees) > 0 {+		to := config.SurveyMissingEmail+		subject := "Missing emails for survey: " + eventName+		bodyText := "The following people did not receive a survey for this protest due to not having a valid email address: "+		bodyText += strings.Join(attendees, ", ")+		bodyHtml := bodyText+		sendEmail(to, subject, bodyText, bodyHtml)+	}+}++func sendEmail(to string, subject string, bodyText string, bodyHtml string) {+	from := config.SurveyFromEmail+	bodyHtml += `<br /><img src="https://adb.dxe.io/static/img/logo1.png" height="46" width="50">`+	// EnvConfig uses the AWS credentials in the environment+	// variables $AWS_ACCESS_KEY_ID nd $AWS_SECRET_KEY.

Marked as resolved but still says "nd"?

jakehobbs

comment created time in 2 months

Pull request review commentdxe/adb

integrate surveys into adb

+package survey_mailer++import (+	"errors"+	"log"+	"strings"+	"time"++	"github.com/dxe/adb/config"+	"github.com/dxe/adb/model"+	"github.com/jmoiron/sqlx"+	"github.com/sourcegraph/go-ses"+)++type SurveyOptions struct {+	SurveyType     string+	QueryDate      string+	QueryEventType string+	QueryEventName string+	BodyText       string+	BodyHtml       string+	LinkParam      string+}++func sendMissingEmail(eventName string, attendees []string, sendingErrors []string) {+	subject := "Missing emails and errors for survey: " + eventName+	to := config.SurveyMissingEmail+	bodyText := ""+	bodyHtml := ""++	if len(attendees) > 0 {+		bodyText += "The following people did not receive a survey for this event due to not having a valid email address: "+		bodyText += strings.Join(attendees, ", ")+		bodyText += ". "+		bodyHtml += "<p>The following people did not receive a survey for this event due to not having a valid email address: <br />"+		bodyHtml += strings.Join(attendees, "<br />")+		bodyHtml += "</p>"+	}+	if len(sendingErrors) > 0 {+		bodyText += "The following addresses did not receive the email due to sending errors: "+		bodyText += strings.Join(sendingErrors, ", ")+		bodyText += ". "+		bodyHtml += "<p>The following addresses did not receive the email due to sending errors <br />"+		bodyHtml += strings.Join(sendingErrors, "<br />")+		bodyHtml += "</p>"+	}++	if bodyText != "" {+		sendEmail(to, subject, bodyText, bodyHtml)+		log.Println("Sending email of missing emails and errors.")+	}+}++func sendEmail(to string, subject string, bodyText string, bodyHtml string) error {+	from := config.SurveyFromEmail+	bodyHtml += `<br /><img src="https://adb.dxe.io/static/img/logo1.png" height="46" width="50">`+	// EnvConfig uses the AWS credentials in the environment+	// variables $AWS_ACCESS_KEY_ID nd $AWS_SECRET_KEY.+	_, err := ses.EnvConfig.SendEmailHTML(from, to, subject, bodyText, bodyHtml)+	if err != nil {+		return errors.New(to)+	}+	return nil+}++func bulkSendEmails(event model.Event, subject string, bodyText string, bodyHtml string) {+	var sendingErrors []string+	for _, recipient := range event.AttendeeEmails {+		log.Println("Sending email to:", recipient)+		// Send email+		err := sendEmail(recipient, subject, bodyText, bodyHtml)+		if err != nil {+			sendingErrors = append(sendingErrors, err.Error())

Maybe change err.Error() to recipient + " (" + err.Error() + ")" (or vice versa) so that you'll know which address the error corresponds to.

jakehobbs

comment created time in 2 months

Pull request review commentdxe/adb

integrate surveys into adb

+package survey_mailer++import (+	"errors"+	"log"+	"strings"+	"time"++	"github.com/dxe/adb/config"+	"github.com/dxe/adb/model"+	"github.com/jmoiron/sqlx"+	"github.com/sourcegraph/go-ses"+)++type SurveyOptions struct {+	SurveyType     string+	QueryDate      string+	QueryEventType string+	QueryEventName string+	BodyText       string+	BodyHtml       string+	LinkParam      string+}++func sendMissingEmail(eventName string, attendees []string, sendingErrors []string) {+	subject := "Missing emails and errors for survey: " + eventName+	to := config.SurveyMissingEmail+	bodyText := ""+	bodyHtml := ""++	if len(attendees) > 0 {+		bodyText += "The following people did not receive a survey for this event due to not having a valid email address: "+		bodyText += strings.Join(attendees, ", ")+		bodyText += ". "+		bodyHtml += "<p>The following people did not receive a survey for this event due to not having a valid email address: <br />"+		bodyHtml += strings.Join(attendees, "<br />")+		bodyHtml += "</p>"+	}+	if len(sendingErrors) > 0 {+		bodyText += "The following addresses did not receive the email due to sending errors: "+		bodyText += strings.Join(sendingErrors, ", ")+		bodyText += ". "+		bodyHtml += "<p>The following addresses did not receive the email due to sending errors <br />"+		bodyHtml += strings.Join(sendingErrors, "<br />")+		bodyHtml += "</p>"+	}++	if bodyText != "" {+		sendEmail(to, subject, bodyText, bodyHtml)+		log.Println("Sending email of missing emails and errors.")+	}+}++func sendEmail(to string, subject string, bodyText string, bodyHtml string) error {+	from := config.SurveyFromEmail+	bodyHtml += `<br /><img src="https://adb.dxe.io/static/img/logo1.png" height="46" width="50">`+	// EnvConfig uses the AWS credentials in the environment+	// variables $AWS_ACCESS_KEY_ID nd $AWS_SECRET_KEY.+	_, err := ses.EnvConfig.SendEmailHTML(from, to, subject, bodyText, bodyHtml)+	if err != nil {+		return errors.New(to)+	}+	return nil+}++func bulkSendEmails(event model.Event, subject string, bodyText string, bodyHtml string) {+	var sendingErrors []string+	for _, recipient := range event.AttendeeEmails {+		log.Println("Sending email to:", recipient)+		// Send email+		err := sendEmail(recipient, subject, bodyText, bodyHtml)+		if err != nil {+			sendingErrors = append(sendingErrors, err.Error())+		}+	}+	sendMissingEmail(event.EventName, event.AttendeeMissingEmails, sendingErrors)+}++func updateSurveyStatus(db *sqlx.DB, eventId int) {+	// Update "survey_sent" to true (1)+	_, err := model.UpdateEventSurveyStatus(db, model.Event{+		ID:         eventId,+		SurveySent: 1,+	})+	if err != nil {+		log.Println("ERROR:", err)+	}+}++func survey(db *sqlx.DB, surveyOptions SurveyOptions) {+	log.Println("Looking for", surveyOptions.SurveyType, "events on", surveyOptions.QueryDate)++	// Get events matching query that that haven't had surveys sent yet+	events, err := model.GetEvents(db, model.GetEventOptions{+		DateFrom:       surveyOptions.QueryDate,+		DateTo:         surveyOptions.QueryDate,+		EventType:      surveyOptions.QueryEventType,+		EventNameQuery: surveyOptions.QueryEventName,+		SurveySent:     "0",+	})+	if err != nil {+		log.Printf("Failed to get events: %v", err)+		return+	}++	// Iterate through events+	for _, event := range events {+		subject := "Survey: " + event.EventName+		// set linkParam based on LinkParam option+		linkParam := ""+		if surveyOptions.LinkParam == "name" {+			linkParam = strings.Replace(event.EventName, " ", "+", -1)+		}+		if surveyOptions.LinkParam == "date" {+			linkParam = event.EventDate.Format("2006-01-02")+		}+		// build body by replacing LINK_PARAM with the actual link param+		bodyText := strings.Replace(surveyOptions.BodyText, "LINK_PARAM", linkParam, -1)+		bodyHtml := strings.Replace(surveyOptions.BodyHtml, "LINK_PARAM", linkParam, -1)

String replacement into HTML is generally unsafe; e.g., the event name might contain <>.

This isn't a security issue since XSS doesn't apply to HTML email, and maybe we don't allow <> in event names anyway, but I'd probably at least put a TODO comment about applying proper escaping.

jakehobbs

comment created time in 2 months

Pull request review commentdxe/adb

integrate surveys into adb

 WHERE 	for _, a := range allAttendance { 		i := eventIDToIndex[a.EventID] 		events[i].Attendees = append(events[i].Attendees, a.ActivistName)-		events[i].AttendeeEmails = append(events[i].AttendeeEmails, a.ActivistEmail)+		if a.ActivistEmail != "" {

I don't think this is a good idea. Before we had the guarantee that Attendees[j] and AttendeeEmails[j] referred to the same activist, but now this will be lost if an attendee in the middle of the list is missing their email.

I think it's better for the survey mailer logic to handle keeping track of attendees who we don't have an email for and thus couldn't survey.

jakehobbs

comment created time in 2 months

issue commentdxe/adb

Generate JSON directly with SQL

Yeah, I didn't realize it was possible before seeing projects like PostGraphile and PostgREST.

As for mutation operations, I don't think there's any significantly new approach there, but I do think the API should be based on simpler atomic operations (eg, create event; create activist; mark activist as attending event; and so on) rather than large complex operations (eg, create this event and record these activists as attending and create any of them if they don't already exist too).

mdempsky

comment created time in 2 months

issue commentdxe/adb

Generate JSON directly with SQL

Handling event_type is a bit complex, because of "noConnections", "mpiDA", and "mpiCOM", but is still doable using CASE expressions, but not unreasonable. It could probably be simplified with help from a helper function. (Can't immediately make sense of how to use CREATE FUNCTION with MySQL though.)

Also, matching on events with a specified activist seemed like it would be complex, but is easily handled with a having clause:

  ...
  group by e.id
  having (:activist_name = '' or bit_or(a.name = :activist_name))
mdempsky

comment created time in 2 months

issue openeddxe/adb

Generate JSON directly with SQL

I think a lot of our SQL queries could be simplified by: (1) having the SQL query grab all the data we're interested in in one pass, and (2) letting MySQL handle aggregating the data into JSON.

Currently we spend a lot of Go code implementing this ourselves. E.g., here's a query that implements the entirety of GetEventsJSON, at least for one particular search predicate (date >= '2019-12-01).

select json_arrayagg(json_object(
    'id', id,
    'name', name,
    'date', date,
    'type', event_type,
    'attendees', attendees
)) from (
  select e.*, json_arrayagg(json_object(
      'id', a.id,
      'name', a.name,
      'email', a.email
  )) as attendees
  from events e
  left join (event_attendance ea, activists a)
  on (e.id = ea.event_id and ea.activist_id = a.id)
  where e.date >= '2019-12-01'
  group by e.id
) x;

I think we can also simplify the logic for handling where clauses by writing them like:

  where (:from_date = '' or e.date >= :from_date)
       and (:to_date = '' or e.date <= ':to_date')

I.e., rather than trying to build different SQL queries based on the search parameters, just write a query that works regardless and let the query optimizer handle it.

created time in 2 months

issue commentgolang/go

proposal: unsafe: add Slice and String types, conversions to replace reflect.{Slice,String}Header

@randall77

If we wait for generics unsafe.Slice is no longer magical:

Package unsafe is inherently magical, so I think waiting for generics to make it non-magical only makes sense if we're wanting to put unsafe.Slice in a different package. But since it's an operation that the compiler can't guarantee is safe, package unsafe seems like the right place to me to make it stand out during code review.

mdempsky

comment created time in 3 months

more