-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Functions returning objects or records #18
Comments
A record might work. Depends on what data you need. |
The type you return is effectively opaque to the caller as it will be passed to the member function as it's first parameter. I'd suggest you write a simple example. compile it and look at the .core file to see what it is doing. |
Thanks, will give it a try |
Sorry, been a bit busy! Still having some trouble with this.
which does not exist Using a record also results in a Any pointers? |
Yes you need to implement the function as generated as an erlang module in
src
…On Fri, 30 Jun 2017 at 17:59, rascala ***@***.***> wrote:
Sorry, been a bit busy!
Still having some trouble with this.
The core file seems to generate a get_<field-name> function.
So using var.Groups in f# seems to generate
'System.Text.RegularExpressions.Match':get_Groups(#{'Captures' => [],'Groups' => [],'Length' => 0,'Success' => false,
'Value' => ''})
which does not exist
Using a record also results in a get_Groups({some, tuple, here})
Any pointers?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#18 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABIDlIAZSYNIR3GU8QFnaMVnLqeOAlm0ks5sJSmFgaJpZM4OC2jf>
.
|
You probably want to pull the latest changes As there are potential changes to how objects are constructed. |
See this as an example. https://github.com/kjnilsson/fez/blob/master/src/System.Lazy_1.erl |
Thanks, I have a very basic regex working(without global-match etc.), but its very ugly with different files for I will try to clean them up a bit, add more tests and add the match-options. Wouldn't it be cleaner if all System.Text.RegularExpressions/* files were grouped into a separate directory? |
Cool. It's fine to have them all in src. It's typical of erlang.
Subdirectories add very little IMO.
…On Sun, 2 Jul 2017 at 15:18, rascala ***@***.***> wrote:
Thanks,
I have a very basic regex working(without global-match etc.), but its very
ugly with different files for
Capture/CaptureCollection/Group/GroupCollection/Match/Regex types and
respective get_<field>s all over.
But it works! And returns captured groups and their values etc.
I will try to clean them up a bit, add more tests and add the
match-options.
Wouldn't it be cleaner if all System.Text.RegularExpressions/* files were
grouped into a separate directory?
And maybe all these should be grouped into a lib/stdlib directory? So that
src does not get cluttered?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#18 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABIDlCmYHP9NXCuysqC8pZjGoQuQtmm8ks5sJ6abgaJpZM4OC2jf>
.
|
@rascala I just made some significant changes to how functions and modules are generated which may affect the work you have in progress. I'd recommend you pull and check the .core files to see what modules and names are required. |
Hi,
I have been looking at implementing the Regex module.
How would I go about returning objects?
(ex: Match object, with .Success, .Groups, .Captures etc.)
Do I just return a map or a record?
The text was updated successfully, but these errors were encountered: