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-qk1-f179.google.com ([209.85.222.179] verified) by selbstdenker.ag (CommuniGate Pro SMTP 6.3.3) with ESMTPS id 25700411 for webobjects-dev@wocommunity.org; Sat, 10 Apr 2021 02:19:59 +0200 Received-SPF: none receiver=post.selbstdenker.com; client-ip=209.85.222.179; envelope-from=recurve@cocoanutstech.com Received: by mail-qk1-f179.google.com with SMTP id q3so7648508qkq.12 for ; Fri, 09 Apr 2021 17:19:59 -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=MhCutwVWR0Uq+8/wLIXRr4zDLVfQWOh0D8IYnVlhMQ0=; b=LlrGKJiy4tEciG2AyrtIfGP0vZ3nFNQT6PSLVROC0cY82ZiCuzzLUjb0cFCuHkH/wA w8JuVe4wxlgoRbYTvYKjpvLdjavTj66v3zCdMhvVzA9YDJqMz4k5KqNMFPLNbEq/whK/ kYyJk8uBYnOQEXrU5MwNF0QTFMclp+1HBHyXU= 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=MhCutwVWR0Uq+8/wLIXRr4zDLVfQWOh0D8IYnVlhMQ0=; b=VCVVkDO3psFCWydeFYMTBfgpq46ZhMMBs0v2/zBQtfQmcmmP6mpNlvtPQg0fZuVb7d ugSi3MbgoGJT6VZCQGwVaA8uEd3D8CvLPWKDsXURtuJeN2uWIo86mMQ2wEaP+SwKW2K9 lODt2zPJdlgM8lOti52s94ew4smbXwlfEuDjsdODWgjH5GsqRZdEpskgB4jEE9Q/yzo+ ggeMnZdv7u2fE7LZiqdtEcJCyTp6VYpBDprsLJtrsA4eIkW9DUh93LD3bN/b1IxkT6xa WVAgcVBY00EsmJ1OPN3J2/ZKIVYOUtiGfePJy+J6haTVPx7AUoJN/cRAucdC/35ECOGm ZrGA== X-Gm-Message-State: AOAM533ugZ1paK7U47pNucw9nZgjb+1RtIgKXb+L1/zyAsF3dQ8x6+Hi q2jfvuaU/dGdFSFa0Dl5WqxUeVSx3OQtyGLaRR0= X-Google-Smtp-Source: ABdhPJxUc5WJbTdpYybl+7pwwdK2UE8tiN0dfnhtXqCfypCflIayR660uIZEFb2EjmYb9NO9uIw5BA== X-Received: by 2002:a37:ac10:: with SMTP id e16mr17351350qkm.314.1618013978117; Fri, 09 Apr 2021 17:19:38 -0700 (PDT) Return-Path: Received: from mac-pro.home (pool-173-79-35-204.washdc.fios.verizon.net. [173.79.35.204]) by smtp.gmail.com with ESMTPSA id 81sm1887108qkl.121.2021.04.09.17.19.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Apr 2021 17:19:36 -0700 (PDT) Message-Id: Content-Type: multipart/alternative; boundary="Apple-Mail=_CA7C5F4B-BDDD-45B0-98DE-B18607EC0F21" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Date: Fri, 9 Apr 2021 20:19:36 -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=_CA7C5F4B-BDDD-45B0-98DE-B18607EC0F21 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi Ricardo,=20 My pleasure, here=E2=80=99s the pull request: = https://github.com/wocommunity/wonder/pull/945 = Speaking of toMany relationships=E2=80=A6 Why did the database administrator leave his wife?=20 She had one-to-many relationships. > On Apr 9, 2021, at 6:32 PM, Ricardo Parada = wrote: >=20 > Hi Aaron, >=20 > Got it. Thanks for the heads up.=20 >=20 > Do you have any plans to submit a pull request for your fix?=20 >=20 > Ricardo Parada=20 >=20 >=20 > Sent from my iPhone >=20 >> On Apr 1, 2021, at 10:02 AM, Aaron Rosenzweig = wrote: >>=20 >> =EF=BB=BFRicardo (and friends) - heads up.=20 >>=20 >> We modified our local branch of WOnder to not null out the toMany = relationship.=20 >>=20 >> We made an innocent mistake of setting an empty immutable NSArray.=20 >>=20 >> Even though most API methods return an interface of =E2=80=9CNSArray=E2= =80=9D internally the data structure is mutable. I believe the primary = idea is that people shouldn=E2=80=99t add/remove from the array = directly. That said, internally, you do need a mutable data structure.=20= >>=20 >> It must be an empty mutable NSMutableArray that you set. If you = don=E2=80=99t, when you try to add something to the toMany relationship = it will fail.=20 >>=20 >>=20 >>> On Mar 25, 2021, at 2:11 PM, Ricardo Parada = > = wrote: >>>=20 >>> I=E2=80=99m gonna play with it but I see a couple of things to = advance this. >>>=20 >>> One is to have an ignoresToManyNullify property that defaults to = false so that we don=E2=80=99t change the existing behavior.=20 >>>=20 >>> Then for us who don=E2=80=99t want to deal with null to-many = relationships. We could set the property to true.=20 >>>=20 >>> Another option is to allow Skip to work on relationships.=20 >>>=20 >>> Thanks Aaron for the feedback.=20 >>>=20 >>> I think that code was written by David Avendasora.=20 >>>=20 >>> Ricardo >>>=20 >>>>=20 >>>> On Mar 25, 2021, at 1:35 PM, Aaron Rosenzweig = > = wrote: >>>>=20 >>>> =EF=BB=BFHi Ricardo, >>>>=20 >>>> I have similar feelings as you do that it=E2=80=99s not right as = is.=20 >>>>=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= >>>>=20 >>>> That said, there are issues with the current state of affairs: >>>>=20 >>>> 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 >>>>=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 >>>>=20 >>>> Cheers, >>>> =E2=80=94 Aaron >>>>=20 >>>>> 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 >>>>=20 >>=20 --Apple-Mail=_CA7C5F4B-BDDD-45B0-98DE-B18607EC0F21 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi = Ricardo, 

My = pleasure, here=E2=80=99s the pull request: https://github.com/wocommunity/wonder/pull/945

Speaking of toMany = relationships=E2=80=A6

Why did the database administrator leave his wife? 
She had one-to-many relationships.

On Apr 9, 2021, at 6:32 PM, Ricardo Parada <webobjects-dev@wocommunity.org> wrote:

Hi Aaron,

Got it. Thanks for the heads = up. 

Do = you have any plans to submit a pull request for your = fix? 

Ricardo Parada 


Sent from my iPhone

On Apr 1, 2021, at 10:02 AM, Aaron Rosenzweig <webobjects-dev@wocommunity.org> wrote:
=EF=BB=BFRicardo (and friends) = - heads up. 

We = modified our local branch of WOnder to not null out the toMany = relationship. 

We made an innocent mistake of setting an empty immutable = NSArray. 

Even though most API methods return an interface of = =E2=80=9CNSArray=E2=80=9D internally the data structure is mutable. I = believe the primary idea is that people shouldn=E2=80=99t add/remove = from the array directly. That said, internally, you do need a mutable = data structure. 

It must be an empty mutable NSMutableArray that you set. If = you don=E2=80=99t, when you try to add something to the toMany = relationship it will fail. 


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

I=E2=80=99m gonna play with it = but I see a couple of things to advance this.

One is to have an ignoresToManyNullify = property that defaults to false so that we don=E2=80=99t change the = existing behavior. 

Then for us who don=E2=80=99t want to deal with null to-many = relationships. We could set the property to true. 

Another option is to = allow Skip to work on relationships. 

Thanks Aaron for the = feedback. 

I think that code was written by David = Avendasora. 

Ricardo


On Mar = 25, 2021, at 1:35 PM, Aaron Rosenzweig <webobjects-dev@wocommunity.org> wrote:
=EF=BB=BFHi 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>
<= br = class=3D"">
<= br class=3D"">
= --Apple-Mail=_CA7C5F4B-BDDD-45B0-98DE-B18607EC0F21--