Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
0475cbb8
Commit
0475cbb8
authored
May 09, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename listener to handler
parent
8a2027a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
34 deletions
+34
-34
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt
...src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt
+34
-34
No files found.
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/event/subscriber.kt
View file @
0475cbb8
...
@@ -133,7 +133,7 @@ interface Listener<in E : Event> : CompletableJob {
...
@@ -133,7 +133,7 @@ interface Listener<in E : Event> : CompletableJob {
/**
/**
* 在指定的 [协程作用域][CoroutineScope] 下创建一个事件监听器, 监听所有 [E] 及其子类事件.
* 在指定的 [协程作用域][CoroutineScope] 下创建一个事件监听器, 监听所有 [E] 及其子类事件.
*
*
* 每当 [事件广播][Event.broadcast] 时, [
listen
er] 都会被执行.
* 每当 [事件广播][Event.broadcast] 时, [
handl
er] 都会被执行.
*
*
*
*
* ### 创建监听
* ### 创建监听
...
@@ -165,7 +165,7 @@ interface Listener<in E : Event> : CompletableJob {
...
@@ -165,7 +165,7 @@ interface Listener<in E : Event> : CompletableJob {
*
```
*
```
*
*
*
####
在监听器内部停止后续监听
*
####
在监听器内部停止后续监听
*
当
[
listen
er
]
返回
[
ListeningStatus
.
STOPPED
]
时停止监听
.
*
当
[
handl
er
]
返回
[
ListeningStatus
.
STOPPED
]
时停止监听
.
*
或
[
Listener
.
complete
]
后结束
.
*
或
[
Listener
.
complete
]
后结束
.
*
*
*
###
子类监听
*
###
子类监听
...
@@ -174,23 +174,23 @@ interface Listener<in E : Event> : CompletableJob {
...
@@ -174,23 +174,23 @@ interface Listener<in E : Event> : CompletableJob {
*
###
异常处理
*
###
异常处理
*
事件处理时的
[
CoroutineContext
]
为调用本函数时的
[
receiver
][
this
]
的
[
CoroutineScope
.
coroutineContext
].
*
事件处理时的
[
CoroutineContext
]
为调用本函数时的
[
receiver
][
this
]
的
[
CoroutineScope
.
coroutineContext
].
*
因此
:
*
因此
:
*
-
当参数
[
listen
er
]
处理抛出异常时
,
将会按如下顺序寻找
[
CoroutineExceptionHandler
]
处理异常
:
*
-
当参数
[
handl
er
]
处理抛出异常时
,
将会按如下顺序寻找
[
CoroutineExceptionHandler
]
处理异常
:
*
1
.
参数
[
coroutineContext
]
*
1
.
参数
[
coroutineContext
]
*
2
.
接收者
[
this
]
的
[
CoroutineScope
.
coroutineContext
]
*
2
.
接收者
[
this
]
的
[
CoroutineScope
.
coroutineContext
]
*
3
.
[
Event
.
broadcast
]
调用者的
[
coroutineContext
]
*
3
.
[
Event
.
broadcast
]
调用者的
[
coroutineContext
]
*
4
.
若事件为
[
BotEvent
],
则从
[
BotEvent
.
bot
]
获取到
[
Bot
],
进而在
[
Bot
.
coroutineContext
]
中寻找
*
4
.
若事件为
[
BotEvent
],
则从
[
BotEvent
.
bot
]
获取到
[
Bot
],
进而在
[
Bot
.
coroutineContext
]
中寻找
*
5
.
若以上四个步骤均无法获取
[
CoroutineExceptionHandler
],
则使用
[
MiraiLogger
.
Companion
]
通过日志记录
.
但这种情况理论上不应发生
.
*
5
.
若以上四个步骤均无法获取
[
CoroutineExceptionHandler
],
则使用
[
MiraiLogger
.
Companion
]
通过日志记录
.
但这种情况理论上不应发生
.
*
-
事件处理时抛出异常不会停止监听器
.
*
-
事件处理时抛出异常不会停止监听器
.
*
-
建议在事件处理中
(
即
[
listen
er
]
里
)
处理异常
,
*
-
建议在事件处理中
(
即
[
handl
er
]
里
)
处理异常
,
*
或在参数
[
coroutineContext
]
中添加
[
CoroutineExceptionHandler
].
*
或在参数
[
coroutineContext
]
中添加
[
CoroutineExceptionHandler
].
*
*
*
*
*
@
param
coroutineContext
给事件监听协程的额外的
[
CoroutineContext
].
*
@
param
coroutineContext
给事件监听协程的额外的
[
CoroutineContext
].
*
@
param
concurrency
并发类型
.
查看
[
Listener
.
ConcurrencyKind
]
*
@
param
concurrency
并发类型
.
查看
[
Listener
.
ConcurrencyKind
]
*
@
param
priority
监听优先级,优先级越高越先执行
*
@
param
priority
监听优先级,优先级越高越先执行
*
@
param
listen
er
事件处理器
.
在接收到事件时会调用这个处理器
.
其返回值意义参考
[
ListeningStatus
].
其异常处理参考上文
*
@
param
handl
er
事件处理器
.
在接收到事件时会调用这个处理器
.
其返回值意义参考
[
ListeningStatus
].
其异常处理参考上文
*
*
*
@
return
监听器实例
.
此监听器已经注册到指定事件上
,
在事件广播时将会调用
[
listen
er
]
*
@
return
监听器实例
.
此监听器已经注册到指定事件上
,
在事件广播时将会调用
[
handl
er
]
*
*
*
@
see
syncFromEvent
挂起当前协程
,
监听一个事件
,
并尝试从这个事件中
**
同步
**
一个值
*
@
see
syncFromEvent
挂起当前协程
,
监听一个事件
,
并尝试从这个事件中
**
同步
**
一个值
*
@
see
asyncFromEvent
异步监听一个事件
,
并尝试从这个事件中获取一个值
.
*
@
see
asyncFromEvent
异步监听一个事件
,
并尝试从这个事件中获取一个值
.
...
@@ -212,27 +212,27 @@ inline fun <reified E : Event> CoroutineScope.subscribe(
...
@@ -212,27 +212,27 @@ inline fun <reified E : Event> CoroutineScope.subscribe(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
concurrency
:
Listener
.
ConcurrencyKind
=
LOCKED
,
concurrency
:
Listener
.
ConcurrencyKind
=
LOCKED
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
noinline
listen
er
:
suspend
E
.(
E
)
->
ListeningStatus
noinline
handl
er
:
suspend
E
.(
E
)
->
ListeningStatus
):
Listener
<
E
>
=
subscribe
(
E
::
class
,
coroutineContext
,
concurrency
,
priority
,
listen
er
)
):
Listener
<
E
>
=
subscribe
(
E
::
class
,
coroutineContext
,
concurrency
,
priority
,
handl
er
)
/**
/**
* 与 [subscribe] 的区别是接受 [eventClass] 参数, 而不使用 `reified` 泛型
* 与 [subscribe] 的区别是接受 [eventClass] 参数, 而不使用 `reified` 泛型
*
*
* @see CoroutineScope.subscribe
* @see CoroutineScope.subscribe
*
*
* @return 监听器实例. 此监听器已经注册到指定事件上, 在事件广播时将会调用 [
listen
er]
* @return 监听器实例. 此监听器已经注册到指定事件上, 在事件广播时将会调用 [
handl
er]
*/
*/
fun
<
E
:
Event
>
CoroutineScope
.
subscribe
(
fun
<
E
:
Event
>
CoroutineScope
.
subscribe
(
eventClass
:
KClass
<
E
>,
eventClass
:
KClass
<
E
>,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
concurrency
:
Listener
.
ConcurrencyKind
=
LOCKED
,
concurrency
:
Listener
.
ConcurrencyKind
=
LOCKED
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
listen
er
:
suspend
E
.(
E
)
->
ListeningStatus
handl
er
:
suspend
E
.(
E
)
->
ListeningStatus
):
Listener
<
E
>
=
eventClass
.
subscribeInternal
(
Handler
(
coroutineContext
,
concurrency
,
priority
)
{
it
.
listen
er
(
it
);
})
):
Listener
<
E
>
=
eventClass
.
subscribeInternal
(
Handler
(
coroutineContext
,
concurrency
,
priority
)
{
it
.
handl
er
(
it
);
})
/**
/**
* 在指定的 [CoroutineScope] 下订阅所有 [E] 及其子类事件.
* 在指定的 [CoroutineScope] 下订阅所有 [E] 及其子类事件.
* 每当 [事件广播][Event.broadcast] 时, [
listen
er] 都会被执行.
* 每当 [事件广播][Event.broadcast] 时, [
handl
er] 都会被执行.
*
*
* 可在任意时候通过 [Listener.complete] 来主动停止监听.
* 可在任意时候通过 [Listener.complete] 来主动停止监听.
* [CoroutineScope] 被关闭后事件监听会被 [取消][Listener.cancel].
* [CoroutineScope] 被关闭后事件监听会被 [取消][Listener.cancel].
...
@@ -241,7 +241,7 @@ fun <E : Event> CoroutineScope.subscribe(
...
@@ -241,7 +241,7 @@ fun <E : Event> CoroutineScope.subscribe(
* @param coroutineContext 给事件监听协程的额外的 [CoroutineContext]
* @param coroutineContext 给事件监听协程的额外的 [CoroutineContext]
* @param priority 处理优先级, 优先级高的先执行
* @param priority 处理优先级, 优先级高的先执行
*
*
* @return 监听器实例. 此监听器已经注册到指定事件上, 在事件广播时将会调用 [
listen
er]
* @return 监听器实例. 此监听器已经注册到指定事件上, 在事件广播时将会调用 [
handl
er]
*
*
* @see CoroutineScope.subscribe 获取更多说明
* @see CoroutineScope.subscribe 获取更多说明
*/
*/
...
@@ -249,8 +249,8 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlways(
...
@@ -249,8 +249,8 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlways(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
concurrency
:
Listener
.
ConcurrencyKind
=
CONCURRENT
,
concurrency
:
Listener
.
ConcurrencyKind
=
CONCURRENT
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
noinline
listen
er
:
suspend
E
.(
E
)
->
Unit
noinline
handl
er
:
suspend
E
.(
E
)
->
Unit
):
Listener
<
E
>
=
subscribeAlways
(
E
::
class
,
coroutineContext
,
concurrency
,
priority
,
listen
er
)
):
Listener
<
E
>
=
subscribeAlways
(
E
::
class
,
coroutineContext
,
concurrency
,
priority
,
handl
er
)
/**
/**
...
@@ -262,14 +262,14 @@ fun <E : Event> CoroutineScope.subscribeAlways(
...
@@ -262,14 +262,14 @@ fun <E : Event> CoroutineScope.subscribeAlways(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
concurrency
:
Listener
.
ConcurrencyKind
=
CONCURRENT
,
concurrency
:
Listener
.
ConcurrencyKind
=
CONCURRENT
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
listen
er
:
suspend
E
.(
E
)
->
Unit
handl
er
:
suspend
E
.(
E
)
->
Unit
):
Listener
<
E
>
=
eventClass
.
subscribeInternal
(
):
Listener
<
E
>
=
eventClass
.
subscribeInternal
(
Handler
(
coroutineContext
,
concurrency
,
priority
)
{
it
.
listen
er
(
it
);
ListeningStatus
.
LISTENING
}
Handler
(
coroutineContext
,
concurrency
,
priority
)
{
it
.
handl
er
(
it
);
ListeningStatus
.
LISTENING
}
)
)
/**
/**
* 在指定的 [CoroutineScope] 下订阅所有 [E] 及其子类事件.
* 在指定的 [CoroutineScope] 下订阅所有 [E] 及其子类事件.
* 仅在第一次 [事件广播][Event.broadcast] 时, [
listen
er] 会被执行.
* 仅在第一次 [事件广播][Event.broadcast] 时, [
handl
er] 会被执行.
*
*
* 可在任意时候通过 [Listener.complete] 来主动停止监听.
* 可在任意时候通过 [Listener.complete] 来主动停止监听.
* [CoroutineScope] 被关闭后事件监听会被 [取消][Listener.cancel].
* [CoroutineScope] 被关闭后事件监听会被 [取消][Listener.cancel].
...
@@ -283,8 +283,8 @@ fun <E : Event> CoroutineScope.subscribeAlways(
...
@@ -283,8 +283,8 @@ fun <E : Event> CoroutineScope.subscribeAlways(
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribeOnce
(
inline
fun
<
reified
E
:
Event
>
CoroutineScope
.
subscribeOnce
(
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
noinline
listen
er
:
suspend
E
.(
E
)
->
Unit
noinline
handl
er
:
suspend
E
.(
E
)
->
Unit
):
Listener
<
E
>
=
subscribeOnce
(
E
::
class
,
coroutineContext
,
priority
,
listen
er
)
):
Listener
<
E
>
=
subscribeOnce
(
E
::
class
,
coroutineContext
,
priority
,
handl
er
)
/**
/**
* @see CoroutineScope.subscribeOnce
* @see CoroutineScope.subscribeOnce
...
@@ -293,9 +293,9 @@ fun <E : Event> CoroutineScope.subscribeOnce(
...
@@ -293,9 +293,9 @@ fun <E : Event> CoroutineScope.subscribeOnce(
eventClass
:
KClass
<
E
>,
eventClass
:
KClass
<
E
>,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
coroutineContext
:
CoroutineContext
=
EmptyCoroutineContext
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
priority
:
Listener
.
EventPriority
=
NORMAL
,
listen
er
:
suspend
E
.(
E
)
->
Unit
handl
er
:
suspend
E
.(
E
)
->
Unit
):
Listener
<
E
>
=
eventClass
.
subscribeInternal
(
):
Listener
<
E
>
=
eventClass
.
subscribeInternal
(
Handler
(
coroutineContext
,
LOCKED
,
priority
)
{
it
.
listen
er
(
it
);
ListeningStatus
.
STOPPED
}
Handler
(
coroutineContext
,
LOCKED
,
priority
)
{
it
.
handl
er
(
it
);
ListeningStatus
.
STOPPED
}
)
)
//
//
...
@@ -462,7 +462,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeDeprecated(
...
@@ -462,7 +462,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
handler
handl
er
=
handler
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -480,7 +480,7 @@ fun <E : Event> CoroutineScope.subscribeDeprecated(
...
@@ -480,7 +480,7 @@ fun <E : Event> CoroutineScope.subscribeDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
handler
handl
er
=
handler
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -496,7 +496,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlwaysDeprecated(
...
@@ -496,7 +496,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeAlwaysDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -514,7 +514,7 @@ fun <E : Event> CoroutineScope.subscribeAlwaysDeprecated(
...
@@ -514,7 +514,7 @@ fun <E : Event> CoroutineScope.subscribeAlwaysDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -528,7 +528,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeOnceDeprecated(
...
@@ -528,7 +528,7 @@ inline fun <reified E : Event> CoroutineScope.subscribeOnceDeprecated(
):
Listener
<
E
>
=
subscribeOnce
(
):
Listener
<
E
>
=
subscribeOnce
(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -544,7 +544,7 @@ fun <E : Event> CoroutineScope.subscribeOnceDeprecated(
...
@@ -544,7 +544,7 @@ fun <E : Event> CoroutineScope.subscribeOnceDeprecated(
eventClass
=
eventClass
,
eventClass
=
eventClass
,
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -561,7 +561,7 @@ inline fun <reified E : BotEvent> Bot.subscribeDeprecated(
...
@@ -561,7 +561,7 @@ inline fun <reified E : BotEvent> Bot.subscribeDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
handler
handl
er
=
handler
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -579,7 +579,7 @@ fun <E : BotEvent> Bot.subscribeDeprecated(
...
@@ -579,7 +579,7 @@ fun <E : BotEvent> Bot.subscribeDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
handler
handl
er
=
handler
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -596,7 +596,7 @@ inline fun <reified E : BotEvent> Bot.subscribeAlwaysDeprecated(
...
@@ -596,7 +596,7 @@ inline fun <reified E : BotEvent> Bot.subscribeAlwaysDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -614,7 +614,7 @@ fun <E : BotEvent> Bot.subscribeAlwaysDeprecated(
...
@@ -614,7 +614,7 @@ fun <E : BotEvent> Bot.subscribeAlwaysDeprecated(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
concurrency
=
concurrency
,
concurrency
=
concurrency
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -628,7 +628,7 @@ inline fun <reified E : BotEvent> Bot.subscribeOnceDeprecated(
...
@@ -628,7 +628,7 @@ inline fun <reified E : BotEvent> Bot.subscribeOnceDeprecated(
):
Listener
<
E
>
=
subscribeOnce
(
):
Listener
<
E
>
=
subscribeOnce
(
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
@PlannedRemoval
(
"1.2.0"
)
@PlannedRemoval
(
"1.2.0"
)
...
@@ -644,6 +644,6 @@ fun <E : BotEvent> Bot.subscribeOnceDeprecated(
...
@@ -644,6 +644,6 @@ fun <E : BotEvent> Bot.subscribeOnceDeprecated(
eventClass
=
eventClass
,
eventClass
=
eventClass
,
coroutineContext
=
coroutineContext
,
coroutineContext
=
coroutineContext
,
priority
=
MONITOR
,
priority
=
MONITOR
,
listen
er
=
listener
handl
er
=
listener
)
)
// endregion
// endregion
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment