X-CGP-ClamAV-Result: CLEAN X-VirusScanner: Niversoft's CGPClamav Helper v1.22.2a (ClamAV engine v0.102.2) X-Junk-Score: 0 [] X-KAS-Score: 0 [] From: "Aaron Rosenzweig" Received: from mail-qt1-f182.google.com ([209.85.160.182] verified) by selbstdenker.ag (CommuniGate Pro SMTP 6.3.3) with ESMTPS id 25627437 for webobjects-dev@wocommunity.org; Thu, 25 Mar 2021 18:35:45 +0100 Received-SPF: none receiver=post.selbstdenker.com; client-ip=209.85.160.182; envelope-from=recurve@cocoanutstech.com Received: by mail-qt1-f182.google.com with SMTP id g24so2262735qts.6 for ; Thu, 25 Mar 2021 10:35:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chatnbike.com; s=chatnbike; h=from:message-id:mime-version:date:subject:in-reply-to:to:references; bh=U29lolyfH2QtqpfkFI41XxGlNWBOnAJAWtHjQGnxDZs=; b=J8geET6P9L2hOjs2gvOofKZ72FMEDWRLO+Itjqw05p+Gn/0cqLL691k1av1fiw18IT AhwN/I/12wZqTY0OFsvGiYXMyJ6v1p/is0JxmBQbMWuEZBOpU+pOF8guike3OQ0TiEfp /VjNmfCIzX3UmPql955ud6G3OUZC6eTAB+dHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:date:subject :in-reply-to:to:references; bh=U29lolyfH2QtqpfkFI41XxGlNWBOnAJAWtHjQGnxDZs=; b=Kx3JIDqPlC1pLf18zRqTBheSUhmIh+DEs8hoH7MqlmlO3UUelXpDvWXFnvEg00fcRE lcHFO9mIXPg/VoMpC1wIomMDD8bD7Q9JFZ//ggPyQyOWIU7n6w8RrBINkGa8NkbU/pOg leTmE3GjUM1tYC1c8BlgIJqF63GBG7/vXnaL/FIckPbcNYsHeWCq3WoUBR4xyYzZqxGu fguOTJ3yLjWvPPZE/vZGE9oalHp1MzK539aH2CC8sv/Pk1UL0ZffL2LEYguF8XvOm3RT 5CBdqsR5eCfO9H3HUgjkGvRYyGi697kB1UgAsMn8xIxp5KYY+K7bt2pO6ImNOlT1xKzq LDow== X-Gm-Message-State: AOAM5317qkbH/c4UZYu98EYJNdFNReboVFEq/bd8AYlZCsSYmtzn84pd Hq5ywl8typ51g8cUQWApvX06NJZ7RSZ01wYdVTA= X-Google-Smtp-Source: ABdhPJypBVD2Z9NSI5GVm+YqVQ30zcNsX9iSZOp3r5wpQ9oNP0k2N4fUw4Di73++m3ADsgyF9APpng== X-Received: by 2002:ac8:688c:: with SMTP id m12mr8798803qtq.74.1616693723334; Thu, 25 Mar 2021 10:35:23 -0700 (PDT) Return-Path: Received: from mac-pro.lan (pool-173-79-35-204.washdc.fios.verizon.net. [173.79.35.204]) by smtp.gmail.com with ESMTPSA id j6sm4584959qkm.81.2021.03.25.10.35.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Mar 2021 10:35:22 -0700 (PDT) Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_89DE9F96-6110-4A08-BA13-0E073FDF2364" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Thu, 25 Mar 2021 13:35:24 -0400 Subject: Re: [WO-DEV] ERXCopyable.CopyType = Nullify on to-many relationship should empty instead In-Reply-To: To: WebObjects & WOnder Development References: X-Mailer: Apple Mail (2.3654.60.0.2.21) --Apple-Mail=_89DE9F96-6110-4A08-BA13-0E073FDF2364 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Ricardo, I have similar feelings as you do that it=E2=80=99s not right as is.=20 I believe the original author had in their mind =E2=80=9Ca perfect = copy=E2=80=9D - meaning that if there was something the copy got from = awakeFromInsertion =E2=80=9Cfor free=E2=80=9D then it isn=E2=80=99t = really a copy of the source=E2=80=A6 so the author asked us to nullify.=20= That said, there are issues with the current state of affairs: 1) =E2=80=9CNullify=E2=80=9D for a toMany relationship should not set it = to =E2=80=9Cnull=E2=80=9D - it should at least set it to an empty array. = Having it =E2=80=9Cnull=E2=80=9D can cause us gas because we are not = expecting toMany relationships to ever be null=E2=80=A6 they can be = empty arrays but not null.=20 2) =E2=80=9CSkip=E2=80=9D is valid for attributes, why not have it valid = for relationships? If we =E2=80=9Cskip=E2=80=9D then we can leave it = alone. For some reason, the author expressly didn=E2=80=99t want = relationships to be skipped. It=E2=80=99s presently a syntax error.=20 Cheers, =E2=80=94 Aaron > On Mar 25, 2021, at 1:25 PM, Ricardo Parada = wrote: >=20 > I think ERXCopyable.java: 1286 should be changed to something like = this: >=20 > case NULLIFY: > // Only set to-one relationships to null. For to-many = relationships we leave it alone with the empty array setup during the = creation of the EO > if (!relationship.isToMany()) { > destination.takeStoredValueForKey(null, relationshipName); > } >=20 >=20 >=20 >=20 >> On Mar 25, 2021, at 1:02 PM, Ricardo Parada = wrote: >>=20 >> =EF=BB=BFHello everyone, >>=20 >> I like that in Wonder when you create an EO all the to-many = relationships are initialized to an empty array because it means that I = don=E2=80=99t have to worry about null checking every time I access the = to-many relationship in order to avoid NullPointerExceptions.=20 >>=20 >> However, if I create my EO by copying an existing one using = ERXCopyable then any to-many relationships that have = ERXCopyable.CopyType set to Nullify will be set to null.=20 >>=20 >> Wouldn=E2=80=99t it be better to set them to an empty array? Or = should we have an Emptify option? >>=20 >> Thanks >> Ricardo Parada --Apple-Mail=_89DE9F96-6110-4A08-BA13-0E073FDF2364 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = Ricardo,

I have = similar feelings as you do that it=E2=80=99s not right as = is. 

I = believe the original author had in their mind =E2=80=9Ca perfect copy=E2=80= =9D - meaning that if there was something the copy got from = awakeFromInsertion =E2=80=9Cfor free=E2=80=9D then it isn=E2=80=99t = really a copy of the source=E2=80=A6 so the author asked us to = nullify. 

That said, there are issues with the current state of = affairs:

1) = =E2=80=9CNullify=E2=80=9D for a toMany relationship should not set it to = =E2=80=9Cnull=E2=80=9D - it should at least set it to an empty array. = Having it =E2=80=9Cnull=E2=80=9D can cause us gas because we are not = expecting toMany relationships to ever be null=E2=80=A6 they can be = empty arrays but not null. 

2) =E2=80=9CSkip=E2=80=9D is valid for = attributes, why not have it valid for relationships? If we =E2=80=9Cskip=E2= =80=9D then we can leave it alone. For some reason, the author expressly = didn=E2=80=99t want relationships to be skipped. It=E2=80=99s presently = a syntax error. 

Cheers,
=E2=80=94 Aaron

On Mar 25, 2021, at 1:25 PM, Ricardo Parada <webobjects-dev@wocommunity.org> wrote:

I think ERXCopyable.java: 1286 = should be changed to something like this:

case NULLIFY:
 =   // Only set to-one relationships to null. For to-many = relationships we leave it alone with the empty array setup during the = creation of the EO
    if = (!relationship.isToMany()) {
      =   destination.takeStoredValueForKey(null, = relationshipName);
    }




On Mar 25, 2021, at 1:02 PM, Ricardo Parada = <webobjects-dev@wocommunity.org> wrote:
=EF=BB=BFHello everyone,

I like that in Wonder = when you create an EO all the to-many relationships are initialized to = an empty array because it means that I don=E2=80=99t have to worry about = null checking every time I access the to-many relationship in order to = avoid NullPointerExceptions. 

However, if I create my EO by copying = an existing one using ERXCopyable then any to-many relationships that = have ERXCopyable.CopyType set to Nullify will be set to = null. 

Wouldn=E2=80=99t it be = better to set them to an empty array? Or should we have an Emptify = option?

Thanks
Ricardo = Parada
<= /div>
= --Apple-Mail=_89DE9F96-6110-4A08-BA13-0E073FDF2364--