maybe not very important feature request

129 views
Skip to first unread message

S.A. Asselbergs

unread,
Oct 14, 2016, 6:17:25 PM10/14/16
to Haxe
Hi
I often do null checks and if null and ofte i set it to a default value. I dont know if Nicolas or others finds it it an interestig idea to add an operator for it. It's not a highly important innovative feature and haxe's future doesnt depend on it (:-P), but how about this:

Now:
if(value==null) value=Option.None; // just an example, there are plenty cases where you want to check things on null

New operator id (?= operator, dont know if it already exist, another is fine too that I leave up to others)
value=? Option.None;

I wont turn sour if Nicolas throws an axe at this, or just plainly ignores this idea. But I am just curious if people would find it useful.

cheers, Simon











Franco Ponticelli

unread,
Oct 15, 2016, 1:02:17 AM10/15/16
to haxe...@googlegroups.com
I find it extremely useful and both C# and Swift have solid implementations of such operators. The only thing I have to argue is that in your example you are mixing types in a strange way.

Assuming `value` of type T you are doing:

Null<T> := Option<T>

Which is not something the compiler will be able to do and probably shouldn't even try.

The conversion should simply be something like:

var x = value ?? 3; // where value is Null<Int> and the operator enforces that x is of type Int

Just for completeness, in absence of such operator, `thx` has a bunch of ways to deal with nullity ... one of them is simply:

var x = Options.ofValue(value); // returns None or Some(value)

Another `using thx.Nulls`:

var x = value.or(3);

This one is particularly interesting (and sometime confusing because you know ... macros):

var x = some.neted.value.or(3); // this checks nullity for `some`, `nested` and `value`.

Franco

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

S.A. Asselbergs

unread,
Oct 16, 2016, 4:37:17 AM10/16/16
to Haxe
Hi Franco,

Sorry I was a bit sloppy with my example. Just found out about thx, awesome library! For people that look for batteries, thx is definately one :-) It reminds me a bit of a fuctional programming library called Stax which was made by John de Goes.

Cheers, Simon


Op zaterdag 15 oktober 2016 07:02:17 UTC+2 schreef Franco Ponticelli:

jacek szymanski

unread,
Oct 16, 2016, 5:26:30 AM10/16/16
to haxe...@googlegroups.com

Well thx is great, I am using it, but writing of batteries I meant things like, say, database drivers, webservice frameworks, xml libraries, things like that.

js.



From: S.a. Asselbergs
Sent: Sunday, October 16, 2016 10:37AM
To: Haxe
Subject: Re: [haxe] maybe not very important feature request

S.A. Asselbergs

unread,
Oct 16, 2016, 7:41:04 AM10/16/16
to Haxe
Hi js.

When I was trying to use Adobe flash for business logic (especially since actionscript2) I had exactly the same situation. In the eraliest of those days there werent much batteries like those you name. So I had to roll my own, and that took my focus of the task at hand. BUT, flash was propriety and I was fully aware I was using the wrong tool for the task at hand.

Haxe is open source and this time it is different, we as a community should scratch our own itches and make these libraries ourselves instead and share instead of saying haxe isnt catering business needs or lacking batteries. With Adobe we had no other option to make request and to be frustrated. This is haxe, it's us. 

Those libraries will slowly get written, and if you or I are in a hurry or dont like the direction, we should start coding those libraries ourselves. That's how things get done, imho. If other languages where more succesful, it wasn't just because they could brag that Facebook used their technology to made their stuff alone, the really big succes came by coincedentally having a lot of meaningful contributions from their respective communities. The failed open source projects didnt fail because they couldnt see what was wrong, they failed because they as a community didnt contribute or maintain and instead put to much energy in inproductive frustration. I dont know if you know Gentoo? To me that is a classical example how a very potent project gets messed up, exactly that I described.

But I agree, it would help if Haxe wouldn't be an all purpose toolbox, but a highly specialised toolbox to one specific purpose. If that is games, fine. If that is business fine. But you need focus to get the right community and the right tool. I think right now haxe is purely for games. You can use it for other things too (as I do that myself), but big part of the community is in (indy)games (and it's founder is too.) Maybe some day haxe will get used for a big business application by a known brand that can be bragged about. But not in the near future, that is certain. It's sometimes frustrating to see all that potential there and being totally unkown to the outside world. But I think the haxe foundation is a good start, but it will be a steep learnig curve or unmet expectations, if that is about getting bragging rights in business.  I have good faith in Nicolas when it comes to dedication, innovation and skill.

Cheers, Simon




Op zondag 16 oktober 2016 11:26:30 UTC+2 schreef Jacek Szymański:

jacek szymanski

unread,
Oct 16, 2016, 2:04:03 PM10/16/16
to haxe...@googlegroups.com

Well it's not like I am just complaining, I also have written libraries (although time does not allow me to develop them into what they should be); but it is and will be too little. I mean, with no support for Oracle or even Postgres, no decent XML parser/serializer, not to say about more things it is hardly possible to develop any serious business application. (BTW am I correct that SSL Socket is not supported on CS?)

I can start coding some of it but not all what is missing, even if I had tenfold the time I have. But that's not the real problem here, I think. If I wanted to push for haxe in my day job (and I'd really want), what can I say? No serious database support, no serious XML support, but we can code it ourselves? I think that for Haxe to be adopted for business applications these abilities are a must, and they must to some degree be supported (semi-)officially by the HF.

js.




From: S.a. Asselbergs
Sent: Sunday, October 16, 2016 1:41PM

Alexander Kuzmenko

unread,
Oct 16, 2016, 5:47:42 PM10/16/16
to Haxe
You can always use platform specific stuff if there is no appropriate haxe lib available.

воскресенье, 16 октября 2016 г., 21:04:03 UTC+3 пользователь Jacek Szymański написал:

Franco Ponticelli

unread,
Oct 16, 2016, 7:42:17 PM10/16/16
to haxe...@googlegroups.com
I know John very well (we worked together for a few years) and I collaborated on Stax many years ago. John has a very functional approach, I still live in between worlds. There is a lot of OO and FP stuff in thx for all tastes :)

Simon Asselbergs

unread,
Oct 17, 2016, 10:50:46 AM10/17/16
to haxe...@googlegroups.com

Hi Franco

John is also a nice guy and has a very clear developer mind. I think he is one of the best developers I have ever spoken. It must have been a joy to have worked with him. John got sick and stax got stuck, I was writing a haskell like graph for stax at the time (and he was learning functional programming to me), only a little later to find myself getting divorced. And my code was lost after I moved out. I have never spoken with John again, I hope he is fine. Is he still using haxe? I havent seen him around on google haxe group...

Cheers, Simon

 


Op 10/17/2016 om 1:41 AM schreef Franco Ponticelli:
You received this message because you are subscribed to a topic in the Google Groups "Haxe" group.

Franco Ponticelli

unread,
Oct 17, 2016, 11:00:51 AM10/17/16
to haxe...@googlegroups.com, John De Goes
He (in CC) is doing great, always exploring interesting new technologies and development techniques. He lost faith in Haxe and last time I checked he was really into Purescript using Scala as a mean to more functional approaches.

Hopefully my description is accurate enough.

Simon Asselbergs

unread,
Oct 17, 2016, 11:08:31 AM10/17/16
to haxe...@googlegroups.com

Haxe google group is a bit quieter than it used to be, or is it just me?


Op 10/17/2016 om 5:00 PM schreef Franco Ponticelli:

Franco Ponticelli

unread,
Oct 17, 2016, 11:20:46 AM10/17/16
to haxe...@googlegroups.com
The several chat channels are more and more used I guess ... too bad there are so many options :)

JLM

unread,
Oct 17, 2016, 11:57:05 AM10/17/16
to Haxe
S.A. Asselbergs

I suspect there is less in the google group because there are a lot more cross target library communities around Haxe now than there used to be, and many language type questions get solved between users in these more chat style hang outs, but suspect a lot of us still read haxelang even if we don't always feel able to comment or choose it to ask questions.

irc://ktxsoftware.com/#kha
https://gitter.im/snowkit/public/  ( also luxe one ).
https://gitter.im/HaxePunk/HaxePunk
https://gitter.im/haxenme/nme
http://community.openfl.org/
http://forum.haxeflixel.com/
flambe - not sure.
https://gitter.im/ianharrigan/haxeui
etc...
and ofcourse there is twitter and stackoverflow.

There is a lot more overall activity in haxe than there used to be it is just spread so it's often harder to keep track of everything that is happening.

Best Justin
Reply all
Reply to author
Forward
0 new messages