profile
viewpoint
Anders Ha andersio London, United Kingdom http://andersha.com/ Make Swift and Kotlin things. Maintains @ReactiveCocoa.

andersio/Cycler 72

[Archived] Unidirectional data flow architecture with SwiftUI and Combine.

andersio/MantleData 5

Reactive tools for using Core Data in Swift.

andersio/ReactiveCocoa 1

Streams of values over time

andersio/apollo-android 0

:robot: A strongly-typed, caching GraphQL client for the JVM, Android and Kotlin multiplatform

andersio/BEMSimpleLineGraph 0

Elegant Line Graphs for iOS. (Charting library)

andersio/BTree 0

Fast ordered collections for Swift using in-memory B-trees

andersio/ChitChat 0

A native Mac app wrapper for WhatsApp Web

andersio/ColladaMorphAdjuster 0

Make shape key/morphers in Blender-exported Collada (.dae) available to Apple SceneKit

issue openedKotlin/kotlinx.coroutines

[native + Darwin] Background dispatchers leak ObjC autorelease references

Also filed as https://youtrack.jetbrains.com/issue/KT-42822 for the K/N runtime.

K/N Workers does not wrap its work items with an autorelease pool. So when coroutine code calls into ObjC/Swift on these worker threads, any autorelease reference leaks unconditionally, e.g., any id or NSObject* return values.

Not sure if this should be sorted at K/N runtime level. But I did notice that in Kotlin Coroutines there are attempts like:

https://github.com/Kotlin/kotlinx.coroutines/blob/1b0e196bc557f03fd9e13b81edb6997bddeb38e7/kotlinx-coroutines-core/native/src/Workers.kt#L48-L50

where workerMain wraps the block in an autoreleasepool.

This isn't enough however, since the pool is drained only after the EventLoop is closed. So seemingly if my thread is long lived, all the autorelease references are effectively leaked for good.

created time in 19 hours

startedujjwalguptaofficial/sqlweb

started time in 8 days

issue commentcashapp/sqldelight

Support for async drivers

I want to add a potential use case: having an IndexedDB driver for Web (bridged via packages like SQLWeb). IndexedDB unfortunately doesn't have synchronous query API in the standard, and unlike Java, there is no way to do a blocking wait on Promises AFAIK.

janvladimirmostert

comment created time in 8 days

PullRequestReviewEvent

issue openedKotlin/kotlinx.coroutines

[native] Dispatchers.Main.immediate

Not sure if this is intentional for Dispatchers.Main.immediateisDispatchNeeded() returns true when called from main thread.

Seems like it should be !invokedImmediately || !isMainThread()?

https://github.com/Kotlin/kotlinx.coroutines/blob/1b0e196bc557f03fd9e13b81edb6997bddeb38e7/kotlinx-coroutines-core/nativeDarwin/src/Dispatchers.kt#L31

created time in 14 days

issue closedtouchlab/SQLiter

`migrateIfNeeded()` and multiple processes

The PRAMGA user_version read for determining need of creation & migration is not part of the subsequent write transaction. It seems to be a plausible race condition, which multiple processes might coincidentially make the decision to run the same prime or migration schema simutaneously. Perhaps the write transaction should be applied to the whole migrateIfNeeded() scope?

https://github.com/touchlab/SQLiter/blob/cabde577c417dd5594e08ae9a98fcdc6f374ee0e/SQLiter/src/nativeCommonMain/kotlin/co/touchlab/sqliter/NativeDatabaseConnection.kt#L84-L95

closed time in 18 days

andersio

issue commenttouchlab/SQLiter

`migrateIfNeeded()` and multiple processes

I reckon iOS File Coordination can be used on the database files to provide guarantees that I need, without needing any change in SQLiter. Thanks anyway.

andersio

comment created time in 18 days

created tagReactiveCocoa/ReactiveCocoa

tag11.1.0

Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

created time in 22 days

push eventReactiveCocoa/ReactiveCocoa

Anders Ha

commit sha cca8bdc26d10a889b8bec3cc2167544df730953e

11.1.0

view details

push time in 22 days

push eventReactiveCocoa/ReactiveCocoa

Petr Pavlik

commit sha 0f5b94cce4ae4209f4b754f72f31f4d41b6cc141

bump package target to iOS 9 and update testing packages (#3712) * Update swift package quick dependency to 3.0.0+ * bump min deployment target to iOS 9 and update Nimble

view details

push time in 22 days

PR merged ReactiveCocoa/ReactiveCocoa

bump package target to iOS 9 and update testing packages

When ReactiveCocoa is imported as a swift package using Xcode 12, it generates following warning deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. This PR fixes the warning by bumping the min. deployment target to iOS 9 when importing this dependency as a swift packages

I've also updated Quick and Nimble dependencies to their latest versions. The ReactiveSwift counterpart PR is here https://github.com/ReactiveCocoa/ReactiveSwift/pull/802.

+8 -26

0 comment

2 changed files

petrpavlik

pr closed time in 22 days

release ReactiveCocoa/ReactiveSwift

6.4.0

released time in 22 days

created tagReactiveCocoa/ReactiveSwift

tag6.4.0

Streams of values over time

created time in 22 days

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 2260221e19eb024382a1b20cdd2c8adc4f48f8b8

6.4.0

view details

push time in 22 days

push eventReactiveCocoa/ReactiveSwift

Petr Pavlik

commit sha 83010c8452d59c173218b4744434b47b56a73116

bump package target to iOS 9 and update testing packages (#802) * bump package target to iOS 9 and update testing packages * update the changelog

view details

push time in 22 days

PR merged ReactiveCocoa/ReactiveSwift

bump package target to iOS 9 and update testing packages

When ReactiveSwift is imported as a swift package using Xcode 12, it generates following warning deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99. This PR fixes the warning by bumping the min. deployment target to iOS 9 when importing this dependency as a swift packages

I've also updated Quick and Nimble dependencies to their latest versions. The ReactiveCocoa counterpart PR is here https://github.com/ReactiveCocoa/ReactiveCocoa/pull/3712.

+10 -6

1 comment

3 changed files

petrpavlik

pr closed time in 22 days

fork andersio/sqldelight

SQLDelight - Generates typesafe Kotlin APIs from SQL

https://cashapp.github.io/sqldelight/

fork in 22 days

issue openedtouchlab/SQLiter

`migrateIfNeeded()` and multiple processes

The PRAMGA user_version read for determining need of creation & migration is not part of the subsequent write transaction. It seems to be a plausible race condition, which multiple processes might coincidentially run the same prime or migration schema simutaneously. Perhaps the write transaction should be applied to the whole migrateIfNeeded() scope?

https://github.com/touchlab/SQLiter/blob/cabde577c417dd5594e08ae9a98fcdc6f374ee0e/SQLiter/src/nativeCommonMain/kotlin/co/touchlab/sqliter/NativeDatabaseConnection.kt#L84-L95

created time in 22 days

issue openedcashapp/sqldelight

[Native driver] Give the main thread its own SQLite connection.

I noticed that the native driver as is supports only one connection, shared across all threads, for any query outside a transaction.

My SQLDelight use case is ported from a native Swift stack, and there are plenty of irregular background processing of pushed payloads from various channels. Many of them do listen/query the database outside transactions. So the current configuration has a high probability causing the read-only queries on the main thread UI to be intermittently blocked by background activities, which isn't quite ideal.

If having a reader connection pool is not on the table (due to complexity to workaround K/N memory model?), I strongly believe that the native driver should at least give the main thread its own connection. This way UI applications can still reap the benefits of SQLite's MVCC WAL mode.

created time in a month

issue openedcashapp/sqldelight

Generate more idiomatic models for projections that select all columns from invovled tables.

Given this query:

getAllCharactersWithBuff:
SELECT character.*, buff.*
FROM Character character LEFT JOIN Buff buff ON character.id = buff.characterId
WHERE character.levelId = ?

It feels like the generated model can do better than listing columns combined from Character and Buff as a flat structure, with those from the latter being individual optional properties.

For exmaple, it could be instead:

data class GetAllCharactersWithBuff(
    character: Character,
    buff: Buff?
)

So columns from buff.* can be accessed as one object, instead of being a sea of optional fields.

created time in a month

issue openedKotlin/kotlinx.coroutines

[native-mt, Darwin] Non-`Main` dispatchers and "event loop was shutdown" exception in tests

Coroutine version: 1.3.9-native-mt Kotlin version: 1.4.10

My testing code has been flaky on Kotlin/Native running on macOS 10.15, with an exception being thrown when it fails.

Uncaught Kotlin exception: kotlin.IllegalStateException: Cannot execute task because event loop was shut down

This happens quite regularly when:

  1. For each @Test case, I launch coroutines via launchIn() on any non-Main dispatcher. Attempts include Unconfined, Default and newSingleThreadContext().

  2. I perform a busy-wait assertion that spins NSRunLoop.mainRunLoop. (should switch to runBlocking I persume, but this is orthogonal to the bug report here)

  3. I forgot to cancel the coroutines with @AfterTest after the test case is completed.

  4. The coroutines keep stacking up, until the exception is thrown eventually.

  5. All subsequent test cases that use the same dispatcher fail, even though they all pass when being run in isolation.

These observations seem to hold — I have tried two different mitigations, and both do suppress the issue:

  • Use Dispatchers.Main in iOS

  • Proactively cancel all coroutines when a test case is done.

Stack trace:

        at 0   test.kexe                           0x0000000100cee35d kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Throwable.kt:23:37)
        at 1   test.kexe                           0x0000000100ce792b kfun:kotlin.Exception#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:23:44)
        at 2   test.kexe                           0x0000000100ce7aeb kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:34:44)
        at 3   test.kexe                           0x0000000100ce7fdb kfun:kotlin.IllegalStateException#<init>(kotlin.String?){} + 91 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/Exceptions.kt:70:44)
        at 4   test.kexe                           0x0000000100ef07fe kfun:kotlinx.coroutines#loopWasShutDown(){}kotlin.Nothing + 222 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/CoroutineContext.kt:25:50)
        at 5   test.kexe                           0x0000000100ef2bbd kfun:kotlinx.coroutines.EventLoopImplPlatform#reschedule(kotlin.Long;kotlinx.coroutines.EventLoopImplBase.DelayedTask){} + 61 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/EventLoop.kt:22:9)
        at 6   test.kexe                           0x0000000100e592cb kfun:kotlinx.coroutines.EventLoopImplBase.rescheduleAllDelayed#internal + 587 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/EventLoop.common.kt:397:13)
        at 7   test.kexe                           0x0000000100e55aee kfun:kotlinx.coroutines.EventLoopImplBase#shutdown(){} + 270 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/EventLoop.common.kt:226:9)
        at 8   test.kexe                           0x0000000100ef305c kfun:kotlinx.coroutines.EventLoopImpl#shutdown(){} + 140 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/EventLoop.kt:34:15)
        at 9   test.kexe                           0x0000000100e53fa4 kfun:kotlinx.coroutines.EventLoop#decrementUseCount(kotlin.Boolean){} + 324 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/EventLoop.common.kt:114:13)
        at 10  test.kexe                           0x0000000100e5407c kfun:kotlinx.coroutines.EventLoop#decrementUseCount$default(kotlin.Boolean;kotlin.Int){} + 124 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/common/src/EventLoop.common.kt:108:5)
        at 11  test.kexe                           0x0000000100eee4c3 kfun:kotlinx.coroutines#runEventLoop(kotlinx.coroutines.EventLoop?;kotlin.Function0<kotlin.Boolean>){} + 1299 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Builders.kt:85:20)
        at 12  test.kexe                           0x0000000100ef72f7 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.start$lambda-0#internal + 407 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Workers.kt:49:17)
        at 13  test.kexe                           0x0000000100ef74de kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$33.invoke#internal + 62 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Workers.kt:47:24)
        at 14  test.kexe                           0x0000000100ef753e kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$33.$<bridge-UNN>invoke(){}#internal + 62 (/opt/buildAgent/work/44ec6e850d5c63f0/kotlinx-coroutines-core/native/src/Workers.kt:47:24)
        at 15  test.kexe                           0x0000000100d1c817 WorkerLaunchpad + 183 (/Users/teamcity/buildAgent/work/cae0e6559deed4c4/runtime/src/main/kotlin/kotlin/native/concurrent/Internal.kt:69:54)
        at 16  test.kexe                           0x0000000100e261df _ZN6Worker19processQueueElementEb + 3135
        at 17  test.kexe                           0x0000000100e25586 _ZN12_GLOBAL__N_113workerRoutineEPv + 54
        at 18  libsystem_pthread.dylib             0x00007fff5dcdc109 _pthread_start + 148
        at 19  libsystem_pthread.dylib             0x00007fff5dcd7b8b thread_start + 15

The exception is thrown at this location: https://github.com/Kotlin/kotlinx.coroutines/blob/1696809ac66753da6f6af71372a3bc4d634f7032/kotlinx-coroutines-core/native/src/EventLoop.kt#L21-L22

created time in a month

issue openedKotlin/kotlinx.coroutines

Flow.zip() triggers K/N InvalidMutabilityException, while Flow.combine() works

Given this reduced

val BackgroundWorkScope = CoroutineScope(newSingleThreadContext("..."))

fun request(): Flow<String> {
    val left = BroadcastChannel<String>(CONFLATED)
    val right = BroadcastChannel<String>(CONFLATED)

    return left.asFlow()
        .zip(right.asFlow()) { lValue, rValue -> "${lValue};${rValue}" }
        .flatMapOnce { it -> flowOf("once: ${it}") }
}

request().launchIn(BackgroundWorkScope)

When the Flow created by request() is executed on different single-thread dispatcher, e.g., via launchIn, InvalidMutabilityException is thrown by Kotlin Coroutines internal.

[Error] mutation attempt of frozen kotlin.native.internal.Ref@39d0f08
kotlin.native.concurrent.InvalidMutabilityException: mutation attempt of frozen kotlin.native.internal.Ref@39d0f08
    at 0   AppName                              0x00000001103d224d kfun:kotlin.Throwable#<init>(kotlin.String?){} + 93
    at 1   AppName                              0x00000001103cb29b kfun:kotlin.Exception#<init>(kotlin.String?){} + 91
    at 2   AppName                              0x00000001103cb4eb kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 91
    at 3   AppName                              0x00000001103fff3b kfun:kotlin.native.concurrent.InvalidMutabilityException#<init>(kotlin.String){} + 91
    at 4   AppName                              0x00000001104017f2 ThrowInvalidMutabilityException + 690
    at 5   AppName                              0x00000001104fb16c MutationCheck + 108
    at 6   AppName                              0x000000011041fa66 kfun:kotlin.native.internal.Ref#<set-element>(1:0){} + 102
    at 7   AppName                              0x00000001105bb850 kfun:kotlinx.coroutines.flow.<no name provided>_1.<no name provided>_1_8.$emit_2_9COROUTINE$196.invokeSuspend#internal + 736
    at 8   AppName                              0x00000001105bbcd0 kfun:kotlinx.coroutines.flow.<no name provided>_1.<no name provided>_1_8.emit_2_9#internal.246 + 320
    at 9   AppName                              0x00000001105a92bb kfun:kotlinx.coroutines.flow.internal.<no name provided>_1.$collect_2$<anonymous>_7COROUTINE$145.invokeSuspend#internal + 6059
    at 10  AppName                              0x00000001103f2f46 kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} + 758
    at 11  AppName                              0x00000001105cf472 kfun:kotlinx.coroutines.DispatchedTask#run(){} + 2802
    at 12  AppName                              0x0000000110538596 kfun:kotlinx.coroutines.EventLoopImplBase#processNextEvent(){}kotlin.Long + 838
    at 13  AppName                              0x00000001105f66df kfun:kotlinx.coroutines#runEventLoop(kotlinx.coroutines.EventLoop?;kotlin.Function0<kotlin.Boolean>){} + 911
    at 14  AppName                              0x00000001105feac7 kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.start$lambda-0#internal + 407
    at 15  AppName                              0x00000001105fecae kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$33.invoke#internal + 62
    at 16  AppName                              0x00000001105fed0e kfun:kotlinx.coroutines.WorkerCoroutineDispatcherImpl.$start$lambda-0$FUNCTION_REFERENCE$33.$<bridge-UNN>invoke(){}#internal + 62
    at 17  AppName                              0x0000000110401397 WorkerLaunchpad + 183
    at 18  AppName                              0x00000001104ffcaf _ZN6Worker19processQueueElementEb + 3135
    at 19  AppName                              0x00000001104ff056 _ZN12_GLOBAL__N_113workerRoutineEPv + 54
    at 20  libsystem_pthread.dylib             0x00007fff5dcdc109 _pthread_start + 148
    at 21  libsystem_pthread.dylib             0x00007fff5dcd7b8b thread_start + 15

However, Flow.combine() as a drop-in replacement of zip works fine in this scenario.

val BackgroundWorkScope = CoroutineScope(newSingleThreadContext("..."))

fun request(): Flow<String> {
    val left = BroadcastChannel<String>(CONFLATED)
    val right = BroadcastChannel<String>(CONFLATED)

    return left.asFlow()
        .combine(right.asFlow()) { lValue, rValue -> "${lValue};${rValue}" }
        .flatMapOnce { it -> flowOf("once: ${it}") }
}

request().launchIn(BackgroundWorkScope)

created time in a month

startedAppPear/ChartView

started time in 2 months

issue commentReactiveCocoa/ReactiveSwift

Potential Effects of SE-0286 on ReactiveSwift

We could mitigate this by applying @_disfavoredOverload, although I don't know if it would have any undesired side effect.

grantjbutler

comment created time in 2 months

issue commentReactiveCocoa/ReactiveSwift

Potential Effects of SE-0286 on ReactiveSwift

I filed https://bugs.swift.org/browse/SR-13453, although what I reproduced doesn't seem to manifest the same way as described by OP.

grantjbutler

comment created time in 2 months

issue commentcashapp/sqldelight

IntelliJ stops indexing generated sources with gradle plugin 1.4.1

Looks like a dup of https://github.com/cashapp/sqldelight/issues/1894. Should I close this @AlecStrong?

andersio

comment created time in 2 months

issue openedcashapp/sqldelight

IntelliJ stops indexing generated sources with gradle plugin 1.4.1

Build Environment SQLDelight version: 1.4.1 IDE version: IntelliJ IDEA 2020.2.1 (Community Edition) Build #IC-202.6948.69, built on August 24, 2020 Runtime version: 11.0.8+10-b944.31 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.15.6 GC: ParNew, ConcurrentMarkSweep Memory: 1979M Cores: 16 Non-Bundled Plugins: org.jetbrains.kotlin, com.squareup.sqldelight

Dialect: SQLite 3.24

Describe the bug If I upgrade the SQLDelight Gradle Plugin to 1.4.1, IntelliJ stops indexing any SQLDelight generated sources, highlighting all generated data classes and interfaces as unresolved references. Gradle builds the project successfully, however.

Only if I stay with Gradle Plugin 1.4.0, IntelliJ indexer stays happy and provides highlighting & autocompletion for the generated source.

created time in 2 months

issue commentReactiveCocoa/ReactiveSwift

Potential Effects of SE-0286 on ReactiveSwift

related: https://bugs.swift.org/browse/SR-6989

grantjbutler

comment created time in 2 months

issue commentReactiveCocoa/ReactiveSwift

Potential Effects of SE-0286 on ReactiveSwift

That overload resolution bug in the compiler had happened before but was resolved. Seems like it is time to file it again.

grantjbutler

comment created time in 2 months

release ReactiveCocoa/Loop

2.0.0-beta3

released time in 2 months

push eventReactiveCocoa/Loop

Anders Ha

commit sha ccc614489688db1829091b3d2481c2345fdab320

2.0.0 beta 3

view details

push time in 2 months

created tagReactiveCocoa/Loop

tag2.0.0-beta3

Composable unidirectional data flow with ReactiveSwift.

created time in 2 months

startedcashapp/sqldelight

started time in 2 months

delete branch ReactiveCocoa/Loop

delete branch : anders/drop-use-of-signal

delete time in 2 months

push eventReactiveCocoa/Loop

Anders Ha

commit sha c6b705757489bcb6c68e43ea20cd7eebf6c4ade7

Make RootLoopBox send the event straight to the Floodgate via `process(_:for:)`.

view details

Anders Ha

commit sha 1fb4826a347910e4ace433a5d1ecff52bc73d143

Tests.

view details

Anders Ha

commit sha d60b0339a9b1ed07f59870c8cb61ea03a9d12e8b

Merge pull request #23 from ReactiveCocoa/anders/drop-use-of-signal Fix a scenario where `Loop.send(_:)` should work but deadlock instead.

view details

push time in 2 months

PR merged ReactiveCocoa/Loop

Fix a scenario where `Loop.send(_:)` should work but deadlock instead. bug

It is using a non-reentrant RAS Signal to inject the event into the Floodgate.

Enqueue the events directly to the Floodgate, which makes it reentrant safe.

+36 -3

0 comment

2 changed files

andersio

pr closed time in 2 months

push eventReactiveCocoa/Loop

Anders Ha

commit sha 1fb4826a347910e4ace433a5d1ecff52bc73d143

Tests.

view details

push time in 2 months

push eventReactiveCocoa/Loop

Anders Ha

commit sha a3aea89c48cd8d2fe6ea7dd3e6c6b3894f00bf31

Tests.

view details

push time in 2 months

PR opened ReactiveCocoa/Loop

Fix a scenario where `Loop.send(_:)` should work but deadlock instead. bug

It is using a non-reentrant RAS Signal to inject the event into the loop internal.

Enqueue the events directly to the Floodgate, which makes it reentrant safe.

+2 -3

0 comment

1 changed file

pr created time in 2 months

create barnchReactiveCocoa/Loop

branch : anders/drop-use-of-signal

created branch time in 2 months

delete branch ReactiveCocoa/Loop

delete branch : anders/patch

delete time in 2 months

push eventReactiveCocoa/Loop

Anders Ha

commit sha e98c89e4add221d463dccf4a698f19e3ef29e5e6

Fix firstValueAfterNil not starting effects when initial state gives non-nil transformed value

view details

Anders Ha

commit sha 525ee386a2c4ce9cc2a3cd4eb2ce136a82d75802

Merge pull request #22 from ReactiveCocoa/anders/patch Fix firstValueAfterNil not starting effects when initial state gives non-nil transformed value

view details

push time in 2 months

PR merged ReactiveCocoa/Loop

Fix firstValueAfterNil not starting effects when initial state gives non-nil transformed value bug

Fix the effect not being started in either of these two scenarios:

  1. Given the firstValueAfterNil transform, the initial state gives a non-nil transformed value.
  2. Given the whenBecomesTrue predicate, the initial state satisfies the predicate.
+57 -1

0 comment

2 changed files

andersio

pr closed time in 2 months

PR opened ReactiveCocoa/Loop

Fix firstValueAfterNil not starting effects when initial state gives non-nil transformed value bug

Fix the effect not being started in either of these two scenarios:

  1. Given the firstValueAfterNil transform, the initial state gives a non-nil transformed value.
  2. Given the whenBecomesTrue predicate, the initial state satisfies the predicate.
+57 -1

0 comment

2 changed files

pr created time in 2 months

create barnchReactiveCocoa/Loop

branch : anders/patch

created branch time in 2 months

PR opened ReactiveCocoa/ReactiveSwift

New observer abstraction for future backpressure support and decluttered stack traces

Preface

A Observer<Value, Error> abstract base class is introduced. It will replace Signal<Value, Error>.Observer as the "currency type" for side effects to be registered with RAS event stream types.

There are three main motivations behind the introduction:

Laying the ground for backpressure support

Backpressure support requires every operator to have extra state for demand management, and a new "subscribed/started" message. This means at the very least:

  • The current Signal.Observer abstraction has to be altered.
  • The signatures of Signal.Event monads backing many unary stream operators, e.g. map, have to be changed, since the barebone level of closure-as-event-sink (Signal.Event) -> Void they are operating at cannot be extended futher to support the new requirements.

Decluttered stack traces

Nominal operator types incidentially improves also the RAS developer experience — symbols in stack traces now clearly attaches to a nominal Observer type, e.g. Operators.Map, while many compiler inserted reabstraction thunks are now gone with the design change.

Before After
image image

Improve performance and reduce ARC traffic

Some operators like throttle and debounce require states that persist across events. The current design forces them to be declared externally to the (Signal.Event) -> Void event sink, and then be captured by the closure context of the event sink. So ARC traffic has to be incurred on both the closure context and each captured references.

Changes

  • The new Observer<Value, Error> base class.
  • Signal.Event.Transformation has a altered signature that is now based on Observer<Value, Error>, instead of (Signal.Event) -> Void.
  • A set of operator implementation has been converted to nonimal types under the Operators namespace. This includes Operators.Map, Operator.Filter and Operator.CompactMap.

Checklist

  • Updated CHANGELOG.md.
+222 -93

0 comment

11 changed files

pr created time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha b6157b00103cefa8368aa2363656973ea0d6c8f1

/Subscriber/Observer/g; Create the `Operators` namespace.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha a7ca36843777bdad952aa2051140265d7ae12baf

Subscriber

view details

push time in 2 months

create barnchReactiveCocoa/ReactiveSwift

branch : observer-refactor

created branch time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 45fea7df6ae8509a35dc377c3dc9f59445db6874

Operator graph

view details

push time in 2 months

create barnchReactiveCocoa/ReactiveSwift

branch : anders/new-internal-prototype

created branch time in 2 months

create barnchReactiveCocoa/ReactiveSwift

branch : type-encoding

created branch time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha e4dbe0943cb6fcb172e0f5c9f6119a65793ac31a

Stop declaring Swift 5.0 support. (#794)

view details

Volodymyr Bondar

commit sha bf337d7969565a2aac52ce1fce74c2d30a78ab16

replaced allEvents by allCases (#796) * replaced allEvents by allCases * Deprecation for source compatibility * Fix a typo Co-authored-by: Anders Ha <anders@andersha.com>

view details

Anders Ha

commit sha 7d16bc5ec8ff3f330bf8ecbe4f625e5402004233

Merge branch 'master' into unserialized-pipes

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 01f5d9bf4455755c5ff501a4ffda65b698ee763c

Extend `nonSerializing()` to properties and producers too.

view details

Anders Ha

commit sha 63a71d7c85b199efdb27aac15017997eb788a040

Make `on()` and `withLatest` non-serializing

view details

Anders Ha

commit sha f0ac694ffb023e8b7a572c13d38fec730a7a73f1

Signals made by Producer can be non-serializing too

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 924a55bb4dbef28ef7c39383d3706b28040bb807

Extend `nonSerializing()` to properties too.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 7e1422a3b6dcbca2298bf2d97a2b97e1e6e40558

Extend `nonSerializing()` to properties too.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha b795c2bcb1bd879a5ebfa90d32e8cdfd44d72da8

Extend `nonSerializing()` to properties too.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 1557e76c3e98e7052d3560d3e293bd92f688dbbc

Precondition: if Constraint is NoValue then Value must be Never

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha c23fa92fff21f1c41e6c75c3dbba503a6d79895a

Constrain flatMapError with `Constraint == OfMany`.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 2bff20594df07fd7f7a628c1693d09b306315d13

Constrain `Value != Never` initializers with `Constraint: DeliversValue`.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha e47b893673c36dd4fd923c85a411ef1f1bcb35b2

Use same-type constraints. Move initializers to be under OfMany.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Volodymyr Bondar

commit sha bf337d7969565a2aac52ce1fce74c2d30a78ab16

replaced allEvents by allCases (#796) * replaced allEvents by allCases * Deprecation for source compatibility * Fix a typo Co-authored-by: Anders Ha <anders@andersha.com>

view details

push time in 2 months

PR merged ReactiveCocoa/ReactiveSwift

replaced allEvents by allCases

Replaced manually enumerated allEvents to allCases from CaseIterable.

Checklist

  • [ ] Updated CHANGELOG.md.
+8 -10

0 comment

1 changed file

vovabndr

pr closed time in 2 months

PR opened ReactiveCocoa/ReactiveSwift

Producer constraints (OfMany, OfOne, Completable) work in progress

Checklist

  • [ ] Updated CHANGELOG.md.
+111 -64

0 comment

8 changed files

pr created time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 4e2e1ec318d8013648a7ed3e510f6de9c3b66295

Completable and ProducerOfOne constraints

view details

push time in 2 months

create barnchReactiveCocoa/ReactiveSwift

branch : final-tagless-1

created branch time in 2 months

push eventvovabndr/ReactiveSwift

Anders Ha

commit sha e4dbe0943cb6fcb172e0f5c9f6119a65793ac31a

Stop declaring Swift 5.0 support. (#794)

view details

Anders Ha

commit sha 19e4be210a237cfd52462106f13d7973cfd6f584

Merge branch 'master' into add-CaseIterable

view details

push time in 2 months

push eventvovabndr/ReactiveSwift

Anders Ha

commit sha ae2b4018542dd8c9a6f310d1bac652e54f0b86e3

Fix a typo

view details

push time in 2 months

delete branch ReactiveCocoa/ReactiveSwift

delete branch : anders/podspec

delete time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha e4dbe0943cb6fcb172e0f5c9f6119a65793ac31a

Stop declaring Swift 5.0 support. (#794)

view details

push time in 2 months

PR merged ReactiveCocoa/ReactiveSwift

Stop declaring Swift 5.0 support. ci:verify

We have adopted @propertyWrapper which requires Swift 5.1+.

Checklist

  • Updated CHANGELOG.md.
+1 -1

3 comments

1 changed file

andersio

pr closed time in 2 months

push eventvovabndr/ReactiveSwift

Anders Ha

commit sha a1744c2b6330d4b85fc74f3691a1b103b917785e

Deprecation for source compatibility

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha dcb2f369822189eba8033e5c5800aa59ee64a622

Fix indentation.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 2ff9ba1c87534636c927e461f07dc0841a6b5a25

Expand the changelog.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 03fd27f9ef00a4908a2328752ce367241790fb92

Changelog

view details

push time in 2 months

PR opened ReactiveCocoa/ReactiveSwift

Non-serializing and Reentrant `Signal`s

Checklist

  • [ ] Updated CHANGELOG.md.
+230 -16

0 comment

4 changed files

pr created time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha 67a489f8e7a064ab98ba0ead92ee6b6d7cc48bf9

Test coverage.

view details

push time in 2 months

push eventReactiveCocoa/ReactiveSwift

Anders Ha

commit sha c2a434955e5635d36158d509f299ba2acfee4534

Offer Signal variants for advanced users.

view details

Anders Ha

commit sha f31a1945de2becdc2dbd6576d9a29eea7c005639

Switch `flatMapEvent` to use `nonSerializing`.

view details

push time in 2 months

create barnchReactiveCocoa/ReactiveSwift

branch : unserialized-pipes

created branch time in 2 months

release ReactiveCocoa/Loop

2.0.0-beta2

released time in 2 months

push eventReactiveCocoa/Loop

Anders Ha

commit sha 09c0093d90f2e1e577c5f91cf1dcb1b8cde12d30

2.0.0-beta2

view details

push time in 2 months

created tagReactiveCocoa/Loop

tag2.0.0-beta2

Composable unidirectional data flow with ReactiveSwift.

created time in 2 months

PR opened ReactiveCocoa/Loop

Fix a scenario which enqueued events are left unprocessed. bug

When Floodgate.withValue owns the recursive lock, events enqueued in parallel might be left unprocessed until another enqueue attempt.

This is because Floodgate.process(_:for:) assumes that, when the call is reentrant, the lock owner is already running an event drain loop. This holds true when Floodgate.process(_:for:) recursively calls itself. But this doesn't hold true when Floodgate.process(_:for:) is the indirect caller of Floodgate.process(_:for:).

This PR refactored the code path, and makes sure that all reducerLock holder fulfills their obligation to drain the event queue after having held the lock.

+57 -20

0 comment

2 changed files

pr created time in 2 months

create barnchReactiveCocoa/Loop

branch : anders/fix-unprocessed-event

created branch time in 2 months

PR opened ReactiveCocoa/Loop

Require ReactiveSwift 6.2
+1 -1

0 comment

1 changed file

pr created time in 2 months

create barnchReactiveCocoa/Loop

branch : anders/ras-6.2

created branch time in 2 months

push eventReactiveCocoa/ReactiveCocoa

Michael Brown

commit sha 6d1b7f953604038707eca7204bd43c97bf102397

Bump SPM swift-tools-version to 5.2 (#3710) * Add ReactiveCocoaObjC as a product * Bump swift-tools-version to 5.2 For the same reason as this was done in ReactiveSwift: so clients aren't forced to pull in test dependencies. * Add swiftLanguageVersions * Update .swift-version to 5.2

view details

push time in 2 months

PR merged ReactiveCocoa/ReactiveCocoa

Bump SPM swift-tools-version to 5.2 ci:verify

For the same reason as this was done in ReactiveSwift, which is so that test dependencies aren't exposed to clients of this package.

+4 -3

4 comments

2 changed files

mluisbrown

pr closed time in 2 months

delete branch andersio/apollo-android

delete branch : api-js

delete time in 3 months

issue commentcashapp/sqldelight

Unable to build iOS kotlin multiplatform app

You need to drop sqldelight:sqlite-driver (which is for JVM) as a common sourceset dependency. Perhaps you meant to include sqldelight:runtime?

tyczj

comment created time in 3 months

startedAutodesk/coroutineworker

started time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha 047886ead99b6db562f7abd3f00b21417143a415

Update apollo-api/api.txt. Mark external JS decl as internal.

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha 9dbcb99c4a5427aaacee01097a0a04cca61dc4f1

Update apollo-api/api.txt. Mark external JS decl as internal.

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha a6b8021040584d7bb8fcc028b34bd335d6a0b86f

Update apollo-api/api.txt for passing the Metalava check.

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha 212a7ee502d7a1e03c8a6e506e0ddf8d4e717260

`apollo-api` JS support. (rebased from dev-3.x to master)

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha 0587be956b26d35d1808d49b208f87971ce66311

`apollo-api` JS support. (rebased from dev-3.x to master)

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha fe78aec2951bae0653f574153b3df9b5b79f4f20

Add a missing @JsName annotation.

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha ab46dd8da6d0c67c3f1f4879264e96ca352bf39a

Update tests to stop using `KClass.qualifiedName()`.

view details

push time in 3 months

push eventandersio/apollo-android

Anders Ha

commit sha dbfb053c08d342df32392805e601469b5dd1f349

Update tests to stop using `KClass.qualifiedName()`.

view details

push time in 3 months

pull request commentapollographql/apollo-android

JS support in apollo-api

@martinbonnin

I have reverted the removals of deprecated methods needing @JsName. It has a knock-on effect in apollo-integration Java sources. I think it is better to be dealt with separately.

For example, removing fromCache() means Java users need to switch to Kotlin synthesized getFromCache(), but the Java convention appears to suggest naming it isFromCache().

Perhaps with all the unnecessary bits reverted, now it makes sense to target 2.x/master instead?

andersio

comment created time in 3 months

more