НА: record updates in Ela

29 views
Skip to first unread message

Василий Воронков

unread,
Jun 23, 2014, 6:06:13 AM6/23/14
to ela...@googlegroups.com
Hi,
Thanks for the interest in Ela!

Standard library offers a couple of functions that can be used for functional record updates. Docs:
http://elalang.net/docs/Article.aspx?p=lib\record.htm

От: rvdalen
Отправлено: ‎23.‎06.‎2014 10:13
Кому: ela...@googlegroups.com
Тема: record updates in Ela

Hi,

I am new to Ela and I am working through the book to see what features Ela has.

One thing I am missing in the book is any mention of functional record updates (ala Haskell).

Does Ela support this or is there another mechanism which can be used to make a copy of a record with certain fields updated?

Regards
--Rouan

--

---
You received this message because you are subscribed to the Google Groups "elalang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elalang+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

rvdalen

unread,
Jun 23, 2014, 6:16:54 AM6/23/14
to ela...@googlegroups.com
Excellent,

Thanks very much for the reply.

The other thing I was wondering is:

Is it possible to use .NET / mono types etc. (like DateTime) directly from within Ela or is this type of .NET inter-operability not supported en Ela.

Regrads
--Rouan

ba...@voronkov.name

unread,
Jun 23, 2014, 6:57:22 AM6/23/14
to ela...@googlegroups.com

Direct interop between .NET and Ela is currently not implemented. The primary reason for that is the fact that .NET types are organized according to OOP principles and it would be really hard to use them from Ela – it would basically require you to wrap all the methods into functional style wrappers, otherwise the code would look pretty clumsy.

 

It is possible to manually extend Ela types with a new type, based on .NET type. You can implement an Ela type in C# by inheriting ElaObject (defined in Ela.dll) or just by writing an Ela module in C# (by inheriting ElaModule) and exposing “raw” functions to work with the data type. Actually ‘datetime’ (from datetime.ela module) is implemented like this.

 

As for data marshalling – it can be done automatically, e.g. Ela types can be converted to .NET types. For example, you can run some Ela code from your C# code and it would fetch a value of a .NET type. Also some built-in Ela types (such as lists, ElaList, or tuples, ElaTuple) can be operated directly within C# code - with some limitations, of course.

Reply all
Reply to author
Forward
0 new messages