Beans in Lucee 6

FYI Lucee 6 now supports internal components, so you can do

susi=new component {
this.name="Susi"
function getName() {
return this.name;
}
}
1 Like

Initially I was sceptical about this, and - in what I think is a first - was pretty much in agreement with @isapir here. No offence Igal, you know what I mean :wink:

However I had a conversation with @seancorfield about all this, and the most valuable takeaway from it is Records, and Data classes | Kotlin Documentation. So there’s precedent out there.

Still… in the CFML context… kinda thinking this is a solution looking for problem. And if the issue is with there being a perception objects are still slow, then deal with that directly. I liked @bdw429s’s assessment of this.


And, I’ll repeat this from another thread. We’ve just had all the excitement of Lucee 6 being done and out the door. I can’t help but think a better use of development time ATM would be fixing bugs (I highlighted the 100-odd critical bugs in Jira ATM. Just to filter down from the 1000-odd open bugs in total). There might be some scope for play time later, closer to when/if Lucee 7 comes out. For now I think technical debt recovery might be a better application of ppl’s efforts…

I mean it might be thankless and uninteresting, but the issues in Jira represent actual things that are preventing ppl from doing what they are trying to do right now. Let’s look @ “right now”, not some speculative future.

5 Likes

In fact, maybe we could just use FW1’s implementation of the Bean. Why reinvent the wheel, when the functionality has already been tried & tested, for many years? :thinking:

I like the idea of smart structs. Did the ideas above turn into any actually features besides inline components?

In my code I create structs to move data around the system. Structs are fast and convenient. Currently I enforce nodes by just making sure I always create them which works because I am a 1 person team. It would be great if there was some interface type system where I could define the blueprint of my structs. I could create components to make it works. The reasons I didn’t initially was components were slow. Yes I go all the way back to ColdFusion 4.5 days. While today components are much faster I still like the easy of using structs.

I want a struct that has a blueprint and is as fast as possible. I don’t use getters or setters currently as I keep my code separate from my data. While not the way most people develop code today. It works for me and is fast.