XML-RPC:64位整数的最佳选择?

时间:2021-07-01 16:52:14

XML-RPC unfortunately doesn't support 64-bit ints in the official standard. It seems there are several extensions that add this support.

遗憾的是,XML-RPC在官方标准中不支持64位整数。似乎有几个扩展添加了这种支持。

Do any of them seem to be more popular or better supported? Which extension do you use?

他们中的任何一个似乎更受欢迎或更好的支持?你使用哪种扩展名?

Answers for all languages appreciated.

所有语言的答案都很受欢迎。

2 个解决方案

#1


Well it seems there's no great answer for this, so we're just making an internal extension that says "integer types are unbounded."

好吧,似乎没有很好的答案,所以我们只是做一个内部扩展,说“整数类型是无限的”。

In our python library, I'm commenting out this check:

在我们的python库中,我正在评论这个检查:

def dump_int(self, value, write):
    # in case ints are > 32 bits
    ## extension: ints can be arbitrarily sized
    ## if value > MAXINT or value < MININT:
    ##    raise OverflowError, "int exceeds XML-RPC limits"

#2


Does this matter? If you're talking about an "incompatible" change, then you're talking about two systems that are, de facto, "incompatible" with the standard, so... just tweak the XML RPC lib you're using and be done with it.

这有关系吗?如果你在谈论一个“不兼容”的变化,那么你谈论的是两个事实上,与标准“不兼容”的系统,所以...只需调整你正在使用的XML RPC库并完成用它。

Otherwise, if you want to remain compatible, welcome to the wonderful world of Strings.

否则,如果您想保持兼容,欢迎来到精彩的弦乐世界。

(update by Mark Harrison) It does matter, since we would like to follow the most common method if other people are also doing this.

(Mark Harrison更新)这很重要,因为如果其他人也在这样做,我们希望遵循最常用的方法。

#1


Well it seems there's no great answer for this, so we're just making an internal extension that says "integer types are unbounded."

好吧,似乎没有很好的答案,所以我们只是做一个内部扩展,说“整数类型是无限的”。

In our python library, I'm commenting out this check:

在我们的python库中,我正在评论这个检查:

def dump_int(self, value, write):
    # in case ints are > 32 bits
    ## extension: ints can be arbitrarily sized
    ## if value > MAXINT or value < MININT:
    ##    raise OverflowError, "int exceeds XML-RPC limits"

#2


Does this matter? If you're talking about an "incompatible" change, then you're talking about two systems that are, de facto, "incompatible" with the standard, so... just tweak the XML RPC lib you're using and be done with it.

这有关系吗?如果你在谈论一个“不兼容”的变化,那么你谈论的是两个事实上,与标准“不兼容”的系统,所以...只需调整你正在使用的XML RPC库并完成用它。

Otherwise, if you want to remain compatible, welcome to the wonderful world of Strings.

否则,如果您想保持兼容,欢迎来到精彩的弦乐世界。

(update by Mark Harrison) It does matter, since we would like to follow the most common method if other people are also doing this.

(Mark Harrison更新)这很重要,因为如果其他人也在这样做,我们希望遵循最常用的方法。