Skip to content

[pigeon] Don't use NSNumber for non-nullable types #116680

@stuartmorgan-g

Description

@stuartmorgan-g

The Objective-C generator uses NSNumber for all the types that the standard codec uses it for; this is the simplest approach, but in many cases it's not the most convenient for clients, or the most idiomatic:

  • Non-nullable arguments that aren't in a collection.
  • Non-nullable fields.
  • Non-nullable return values.

The last is particularly weird; you basically never see a method in ObjC return an NSNumber representing a boolean, because nullable boolean returns are almost always a terrible concept, and most booleans that one works with in ObjC are BOOLs; you generally only box them if you need to put them in a collection.

This would add generator complexity, but having done something along these lines for the C++ generator (where the exact translation of a type depends on the context) it's not terrible.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work listp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions