Wiki

Ticket #249 (closed defect: wontfix)

Opened 14 years ago

Last modified 11 years ago

property without type works in cobra, is exposed to C# as object

Reported by: nevdelap Owned by:
Priority: minor Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: Cc:

Description

class P

	get x			# Cobra doesn't need 'as bool', and works fine when
		return 1 > 2	# used from cobra, but when used from C# (gmcs) it complains...
				# error CS0266: Cannot implicitly convert type 'object' to 'bool'

	def y as bool		# Requires the as bool.
		return 1 > 3

	def main
		print .x
		print .y

Change History

Changed 14 years ago by Chuck

The default return type of untyped member vars and properties is "dynamic". And everything works because Cobra has excellent support for this.

But Cobra targets .NET 2.0 where no such concept of "dynamic" exists. Cobra's "dynamic" degrades to the closest available concept which is "object". Certainly for .NET 4.0, Cobra should use the "dynamic" type, but it's not clear that's what you meant for this ticket.

I will likely close this as wontfix and we can add a new ticket for the use of "dynamic" when on .NET 4.0.

Changed 11 years ago by hopscc

  • status changed from new to closed
  • resolution set to wontfix

enhancement for this added as ticket:319

Note: See TracTickets for help on using tickets.