-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mv register #139
base: master
Are you sure you want to change the base?
Mv register #139
Conversation
@@ -176,6 +174,25 @@ class TrxTest { | |||
} | |||
} | |||
|
|||
@JsName("Counter_test") | |||
@Test | |||
fun `Counter test`() { // TODO: find an appropriate place for this test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Что тестирует этот тест?
И чёт кажись счётчикам таки нужен отдельный тип/класс с операциями ограниченными до inc/dec
|
||
@JsName("qbit_should_accumulate_concurrent_increments_of_counter") | ||
@Test | ||
fun `qbit should accumulate concurrent increments of counter`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это тест по хорошему должен быть в ПРе со счётчиками, не?
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
class Register<T>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Мне тут не нравится всё
- Нельзя использовать изменяемые структуры данных
- почему АПИ позволяет создание сразу "переполненого регистра"?
- У меня точно было это в голове и кажись мы где-то в чатиках обсуждали, что регистры должны быть обычными типами данных, на которые в схеме навешана функция свёртки списка в одно значение
- Я щяс чёт ваще не вижу, чтобы этот тип добавлял какую-то ценность относительно списков
|
||
fun <T : Any> ofValue(value: T?): DataType<T>? = when (value) { | ||
fun <T : Any> ofValue(value: T?): DataType<T>? = when (value) { // TODO REFACTOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Рефактор что, как, зачем?
list == null || list.isEmpty() || list.firstOrNull()?.let { DataType.ofValue(it)?.value() } ?: true // TODO REFACTOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тот же вопрос
(elementDescriptor.getElementDescriptor(0).getElementDescriptor(0).kind is PrimitiveKind || | ||
elementDescriptor.getElementDescriptor(0).getElementDescriptor(0).kind == StructureKind.LIST) // ByteArray | ||
|
||
private fun isRefRegister(elementDescriptor: SerialDescriptor, value: Any) = // TODO REFACTOR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как?
@@ -231,6 +249,13 @@ enum class ValueKind { | |||
private fun isRefList(elementDescriptor: SerialDescriptor, value: Any) = | |||
elementDescriptor.kind == StructureKind.LIST && value is List<*> | |||
|
|||
private fun isValueRegister(elementDescriptor: SerialDescriptor, value: Any) = | |||
value is Register<*> && //TODO DEDUPLICATE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
С чем?
private fun isScalarRef(elementDescriptor: SerialDescriptor) = | ||
elementDescriptor.kind == StructureKind.CLASS | ||
private fun isScalarRef(elementDescriptor: SerialDescriptor, value: Any) = | ||
elementDescriptor.kind == StructureKind.CLASS && value !is Register<*> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!is Register<*>
надо где-то заныкать в виде isNotIntrinsic
No description provided.