tracker issue : CF-4202222

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: if bif(simpleValue) works then simpleValue.memberFunction() member functions must also work

| View in Tracker

Status/Resolution/Reason: Needs Review//EnhancementRequired

Reporter/Name(from Bugbase): Aaron Neff / ()

Created: 05/01/2018

Components: Language, Member Functions

Versions: 2018

Failure Type: Usability Issue

Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) /

Priority/Frequency: Normal / All users will encounter

Locale/System: / Platforms All

Vote Count: 2

Issue: if bif(simpleValue) works then simpleValue.memberFunction() must also work

History (as of Aether):
- CF string and numeric member functions work on java.lang.String, java.lang.Integer, coldfusion.runtime.CFDouble and java.math.BigDecimal
- CF date member functions work on java.lang.String and coldfusion.runtime.OleDateTime

Member functions must be type-casting, not type-specific, because:
1) CF is a loosely-typed language. Developers don't declaratively enforce a type when initializing simple values. CF runtime casts simple values however/whenever needed.
2) Member functions were sold to us as syntactic sugar for BIFs, not as proper methods on proper objects of any explicit type.
3) The java classes being used behind-the-scenes is an implementation detail, and it wouldn't even make sense for CF to provide a first-class method to test a simple variable to see what actual java class is being used.

Therefore, it is incorrect to expect developers to know what java classes have been used behind the scenes and to limit functionality based on that.

(credit to Brad Wood)

Attachments:

Comments: