From fritchie@REDACTED Tue Jun 1 05:10:40 2004 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 31 May 2004 22:10:40 -0500 Subject: ErlCee++ In-Reply-To: Message of "Mon, 31 May 2004 13:05:02 EDT." <20040531170502.GA31531@spearce.org> Message-ID: <200406010310.i513AeVv001016@snookles.snookles.com> >>>>> "sp" == Shawn Pearce writes: sp> - "lightweight" processes. Some of the concurrent activity could sp> actually be modeled through simple callbacks to user code, much sp> how gen_server behaves in Erlang. Multiple services could share sp> the same heavyweight POSIX thread or UNIX process. I don't know if this would actually help, but I'm working with folks who have written a *lot* of software in C++ with the State Threads library over at SourceForge. It works as advertised, is as about as "light" as advertised, and is industrial strength. Even if it's running on Linux. Good luck with the selective receive. In idle flights of fancy, I've wondered about gluing selective receive into Python. Good luck, and keep up posted with an forthcoming breakthroughs. -Scott From roger.larsson@REDACTED Tue Jun 1 08:11:49 2004 From: roger.larsson@REDACTED (Roger Larsson) Date: Tue, 1 Jun 2004 08:11:49 +0200 Subject: ErlCee++ In-Reply-To: <20040531170502.GA31531@spearce.org> References: <20040531170502.GA31531@spearce.org> Message-ID: <200406010811.49844.roger.larsson@norran.net> On Monday 31 May 2004 19.05, Shawn Pearce wrote: > Erlang was proposed, but since nobody on the full time staff > actually has even heard of Erlang, it was dismissed as "not a viable > solution" without any real consideration. Sounds like a general saying "I have never heard of a machine gun" /RogerL -- Roger Larsson Skellefte? Sweden From bengt.kleberg@REDACTED Tue Jun 1 09:35:26 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 01 Jun 2004 09:35:26 +0200 Subject: make install In-Reply-To: References: Message-ID: <40BC31BE.80107@ericsson.com> Roger Price wrote: ...deleted >I suggest that the installation procedure include > rm -rf /usr/local/lib/erlang > > > may i suggest that only the new target gets cleaned out? sometimes it is of interest to keep the old version available. bengt From olgeni@REDACTED Tue Jun 1 11:23:56 2004 From: olgeni@REDACTED (Jimmy Olgeni) Date: Tue, 1 Jun 2004 11:23:56 +0200 (CEST) Subject: "wildcards" in .rel files Message-ID: <20040601111401.J41056@dev1.localdomain.net> Hi, Is there a way to specify a wildcard ("*") in a .rel file, so that it gets the latest version available? I'm using .rel files to build boot scripts and I'd like systools:make_script to work across OTP releases using whatever it finds. -- jimmy From ulf.wiger@REDACTED Tue Jun 1 13:36:09 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 1 Jun 2004 13:36:09 +0200 Subject: "wildcards" in .rel files Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402755@ESEALNT442.al.sw.ericsson.se> This is one of the things that 'builder' (see Jungerl) gives you: you can either specify version, or let 'builder' find the latest version - for each application. /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Jimmy Olgeni > Sent: den 1 juni 2004 11:24 > To: erlang-questions@REDACTED > Subject: "wildcards" in .rel files > > > > Hi, > > Is there a way to specify a wildcard ("*") in a .rel file, so that it > gets the latest version available? I'm using .rel files to build boot > scripts and I'd like systools:make_script to work across OTP releases > using whatever it finds. > > -- > jimmy > From erlang@REDACTED Tue Jun 1 13:54:32 2004 From: erlang@REDACTED (Inswitch Solutions - Erlang Evaluation) Date: Tue, 1 Jun 2004 08:54:32 -0300 Subject: Behaviour module attribute meaning Message-ID: <006401c447cf$7e0c6380$1e00a8c0@design> Does someone know what the behaviour module attribute do? I have a GEN_FSM callback module without "-behaviour(gen_fsm)." attribute and it works. thanks in advance, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From ulf.wiger@REDACTED Tue Jun 1 14:07:36 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 1 Jun 2004 14:07:36 +0200 Subject: Behaviour module attribute meaning Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402757@ESEALNT442.al.sw.ericsson.se> If the -behaviour() attribute is present, the linter checks whether the exported functions required by the given behaviour are in fact present in the module. If not, the linter issues a warning for each missing function. The set of functions to be exported for a given behaviour is specified by Behaviour:behaviour_info(callbacks) -- for example, 1> gen_server:behaviour_info(callbacks). [{init,1}, {handle_call,3}, {handle_cast,2}, {handle_info,2}, {terminate,2}, {code_change,3}] /Uffe -----Original Message----- From: owner-erlang-questions@REDACTED [mailto:owner-erlang-questions@REDACTED]On Behalf Of Inswitch Solutions - Erlang Evaluation Sent: den 1 juni 2004 13:55 To: erlang-questions@REDACTED Subject: Behaviour module attribute meaning Does someone know what the behaviour module attribute do? I have a GEN_FSM callback module without "-behaviour(gen_fsm)." attribute and it works. thanks in advance, Eduardo Figoli INSwitch Solutions -------------- next part -------------- An HTML attachment was scrubbed... URL: From mlogan@REDACTED Tue Jun 1 17:11:36 2004 From: mlogan@REDACTED (Martin J. Logan) Date: 01 Jun 2004 10:11:36 -0500 Subject: "wildcards" in .rel files In-Reply-To: <20040601111401.J41056@dev1.localdomain.net> References: <20040601111401.J41056@dev1.localdomain.net> Message-ID: <1086102696.2139.4532.camel@dhcp-lom-194-186.futuresource.com> Jimmy, I have attached the library that I wrote to do just that. .rel file can be written like the following; {release, {"insight_rel", "1.0"}, erts, [ kernel, stdlib, {sasl, "1.9.4"}, xmerl, xmlrpc, fslib, gas, {system_status, none}, insight ] }. as you can see if you need to specify a particular version of an app you can but in general it is nice to leave them off and just let the boot_smithe pic the version for you. The source code has examples of invocations within its documentation. Cheers, Martin On Tue, 2004-06-01 at 04:23, Jimmy Olgeni wrote: > Hi, > > Is there a way to specify a wildcard ("*") in a .rel file, so that it > gets the latest version available? I'm using .rel files to build boot > scripts and I'd like systools:make_script to work across OTP releases > using whatever it finds. -------------- next part -------------- %%% $Id: fs_boot_smithe.erl,v 1.16 2004/04/26 21:46:41 enewhuis Exp $ %%%------------------------------------------------------------------- %%% File : fs_boot_smithe.erl %%% Author : Martin J. Logan %% %%% @doc

A library to create script and boot files.

%%% FileWide Types and Definitions. *README* or the docs will make little sense. %%%
%%% version() - is a version number for an application. These version 
%%%             numbers are always contain atleast one if not more periods and are strings.
%%%             Type: string()
%%%             Examples: "1.3.21" or "1.10" 
%%% 
%%% libdir() - The path to a directorythat contains erlang applications
%%%            Example: "/home/martin/work/otp/lib" which contains the dirs for edoc, xmlrpc...
%%%            The dirs under this libdir() can either contain a .app file with a version number in it
%%%            or may be named with a prefix containing no - chars followed by a - and a version()
%%%            Example: "/usr/local/lib/erlang/lib which contains stdlib-1.12, mnesia-4.12.4 and so on.
%%%            These paths may contain the wildcard * which will cause it to evaluate to all dirs including the "empty dir" 
%%%            that match the string.
%%%            Example: "/home/martin/*" will evaluate to "/home/martin" and "/home/martin/work" if the only dir under
%%%            /home/martin is work.
%%%
%%% relsrc() - This is a structure that embodies the src spec for a release. This structure can be used by 
%%%            functions in this module to create an valid OTP release file with proper version numbers and formatting. 
%%%
%%% release_spec() = AppName | {AppName ,| AppVsn ,| AppType ,| IncApps} note* ,| is to be interpreted as "and or"
%%%       AppName = atom()
%%%       AppType = permanent | transient | temporary | load | none
%%%       IncApps = [atom()]
%%%
%%% Examples:
%%% rel.src 
%%%
%%% {release, {my_rel, "1.2.31"}
%%%  erts,
%%%  [
%%%   kernel,
%%%   stdlib,
%%%   mnesia,
%%%   {resource_discovery, "2.12.4"}
%%%   gas,
%%%   {galaxy_parser, none},
%%%   gq
%%%  ]
%%% }. 
%%%
%%%
%%% 
%%% @end %%% %%% Created : 29 Jan 2004 by Martin J. Logan %%%------------------------------------------------------------------- -module(fs_boot_smithe). %%-------------------------------------------------------------------- %% Include files %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% External exports %%-------------------------------------------------------------------- -export([ app_vsn_and_location/1, app_paths/2, app_paths/1, make_rel_file/5, make_rel_file/2, make_script_and_boot/6, make_script_and_boot/3, local_app_vsn/2, compair_version_strings/2 ]). %%-------------------------------------------------------------------- %% Macros %%-------------------------------------------------------------------- %%-------------------------------------------------------------------- %% Records %%-------------------------------------------------------------------- -record(release_spec, {app_name, version = undefined, app_type = undefined, inc_apps = undefined}). %%==================================================================== %% External functions %%==================================================================== %%-------------------------------------------------------------------- %% @doc This function will return a dict where keys are AppName and values consist of list of tuples of {version(), LibDir} for example %% a key might be gas and a value [{"3.4.2", "/usr/local/lib/erlang/lib"}]. %% Each LibDir is checked for existence. If it does not exist it will not be included in the final list. %% %% Note* This function has a precidence order for application vsns. It first prefers local apps followed by the highest vsn of an installed app. %% %%
%% Types: 
%%  LibDirs = [libdir()] 
%%  AppVsnLocation = dict()
%% 
%% @spec app_vsn_and_location(LibDirs) -> AppVsnLocation %% @end %%-------------------------------------------------------------------- app_vsn_and_location(LibDirs) -> AllLibDirs = lists:foldl(fun(LibDir, Acc) -> case hd(lists:reverse(LibDir)) of $* -> [filename:dirname(LibDir)|filelib:wildcard(LibDir)] ++ Acc; _ -> filelib:wildcard(LibDir) ++ Acc end end, [], LibDirs), lists:foldl(fun(LibDir, Acc) -> app_vsn_and_location2(LibDir, Acc) end, dict:new(), AllLibDirs). app_vsn_and_location2(LibDir, AccDict) -> AbsLibDir = abs_path(LibDir), IgnoreListingsFor = ["Makefile", "CVS"], {ok, LibDirNameList} = file:list_dir(AbsLibDir), CleanLibDirNameList = LibDirNameList -- IgnoreListingsFor, LibAppAndVsnFun = fun(AppDir, Dict) -> case string:tokens(AppDir, "-") of [AppName] -> case catch local_app_vsn(AbsLibDir, AppName) of {'EXIT', Reason} -> Dict; LocalAppVsn -> dict:append(list_to_atom(AppName), {LocalAppVsn, AbsLibDir}, Dict) end; [AppName, Vsn] = FullNameWithDash -> case catch list_to_integer(lists:flatten(string:tokens(Vsn, "."))) of {'EXIT', Reason} -> exit({error, {badname, AppDir}}); _Float -> dict:append(list_to_atom(AppName), {Vsn, AbsLibDir}, Dict) end; _ -> exit({error, {badname, AppDir}}) end end, lists:foldl(LibAppAndVsnFun, AccDict, CleanLibDirNameList). %%-------------------------------------------------------------------- %% @doc This function will return a list of full paths to app dirs within a local otp build system. %% Each app path is checked for existence. If it does not exist it will not be included in the final list. %% %% Note* This function has a precidence order for application vsns. It first prefers local apps followed by the highest vsn of an installed app. %% %%
%% Types: 
%%  LibDirs = [libdir()]
%%  AppPaths = [string()]
%% 
%% @spec app_paths(LibDirs) -> AppPaths %% @end %%-------------------------------------------------------------------- app_paths(LibDirs) -> Dict = dict:map(fun(Key, Value) -> lists:sort(fun({V1, P1}, {V2, P2}) -> compair_version_strings(V1, V2) end, Value) end, app_vsn_and_location(LibDirs)), [make_path(Path, atom_to_list(AppName), Vsn) || {AppName, [{Vsn, Path}|T]} <- dict:to_list(Dict)]. make_path(AppPath, AppNameString, Vsn) -> case filelib:is_dir(AppPath ++ "/" ++ AppNameString) of true -> AppPath ++ "/" ++ AppNameString; false -> AppPath ++ "/" ++ AppNameString ++ "-" ++ Vsn end. %%-------------------------------------------------------------------- %% @doc This function will return a list of full paths to app dirs contained in the %% applications specified in IncludedApps within a local otp build system. %% Note* if any of the included apps can't be verified then an error will be returned. %%
%% Varibles:
%%  IncludedApps - The Applications to be included in AppAndVsns
%%  AppPaths - A list of full paths to .app files for all library apps in the LibDir.
%%              Example: ["/home/martin/work/otp/lib/xmlrpc"]
%%
%% Types: 
%%  LibDirs = [libdir()]
%%  IncludedApps = [atom()]
%%  AppPaths = [string()]
%% 
%% @spec app_paths(LibDirs, IncludedApps) -> AppPaths | {error, {enotfound, MissingIncludedApps}} %% @end %%-------------------------------------------------------------------- app_paths(LibDirs, IncludedApps) -> Dict = dict:map(fun(Key, Value) -> lists:sort(fun({V1, P1}, {V2, P2}) -> compair_version_strings(V1, V2) end, Value) end, app_vsn_and_location(LibDirs)), AppVsnLocations = dict:to_list(Dict), case IncludedApps -- [AppName || {AppName, {Vsn, Path}} <- AppVsnLocations] of [] -> [make_path(Path, atom_to_list(AppName), Vsn) || {AppName, [{Vsn, Path}|T]} <- AppVsnLocations, lists:member(AppName, IncludedApps)]; Apps -> {error, {enotfound, Apps}} end. %%-------------------------------------------------------------------- %% @doc Creates an otp release file from a list of applications. %%
%% Varibles:
%%  RelName - A name for this release. The .rel file created by this function will be titled RelName.rel
%%  RelVsn - A version number for the release.
%%  ErtsSpec - The release spec for the erts application. 
%%  ReleaseSpecs - A list of individual ReleaseSpec's informing the system of how to load
%%                 a particular application within a release. 
%%
%% Sample Invocation:
%%  boot_smithe:make_rel_file(["/usr/local/lib/erlang/*", "/home/martin/work/otp/lib"], 
%%                                "therel", "myrel", "1.2", erts, [kernel, stdlib, sasl, {system_status, none}, insight]).
%%
%%
%% Types:
%%  LibDirs = [libdir()]
%%  RelName = string()
%%  RelVsn = version()
%%  ErtsSpec = erts | {erts,  version()}
%%  ReleaseSpecs = [release_spec()] for release_spec() definition see the top of this file.
%% 
%% @spec make_rel_file(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs) -> ok | exit() %% @end %%-------------------------------------------------------------------- make_rel_file(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs) -> AppVsnLocationDict = app_vsn_and_location(LibDirs), SortedAppVsnLocationDict = sort_app_vsn_and_location_dict(AppVsnLocationDict), AppAndVsns = [{AppName, Vsn} || {AppName, [{Vsn, Path}|T]} <- dict:to_list(SortedAppVsnLocationDict), lists:member(AppName, [erts|ReleaseSpecs]) orelse lists:keymember(AppName,1, ReleaseSpecs)], CompleteErtsSpec = flesh_out_erts_release_spec(AppAndVsns, ErtsSpec), CompleteReleaseSpecs = tuplize_release_specs(flesh_out_release_specs(AppAndVsns, ReleaseSpecs)), {ok, FD} = file:open(RelName ++ ".rel", [write]), io:fwrite(FD, "~p.", [{release, {RelName, RelVsn}, CompleteErtsSpec, CompleteReleaseSpecs}]). %%-------------------------------------------------------------------- %% @doc Creates an otp release file from a file containing relsrc(). %%
%% Varibles:
%%  RelSrcFilename -  The name of the file containing the relsrc().
%%
%% Sample Invocation:
%%  boot_smithe:make_rel_file(["/usr/local/lib/erlang/*", "/home/martin/work/otp/lib"], "myrel.rel.src").
%%
%%
%% Types:
%%  LibDirs = [libdir()]
%%  RelName = string()
%%  RelVsn = version()
%%  ErtsSpec = erts | {erts,  version()}
%%  ReleaseSpecs = [release_spec()] for release_spec() definition see the top of this file.
%% 
%% @spec make_rel_file(LibDirs, RelSrcFilename) -> {ok, RelName} | exit() %% @end %%-------------------------------------------------------------------- make_rel_file(LibDirs, RelSrcFilename) -> {ok, [{release, {RelName, RelVsn}, ErtsSpec, ReleaseSpecs}]} = file:consult(RelSrcFilename), ok = fs_boot_smithe:make_rel_file(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs), {ok, RelName}. %%-------------------------------------------------------------------- %% @doc Creates a rel file as well as a script and boot file from a list of applications. Searches the paths that code knows about. %%
%% Varibles:
%%  RelName - A name for this release. This name will be translated into
%%            BaseFileName.rel, BaseFileName.script, and BaseFileName.boot.
%%  RelVsn - A version number for the release. 
%%  ErtsSpec - The release spec for the erts application. 
%%  ReleaseSpecs - A list of individual ReleaseSpec's informing the system of how to load
%%                 a particular application within a release. 
%%  SystoolsOpts - Are options to be passed to the sasl application systools:make_script/2 see those docs for type info.
%%
%% Sample Invocation:
%%  boot_smithe:create_release_scripts_from_relsrc(["/usr/local/lib/erlang/*", "/home/martin/work/otp/lib"], "myrel", "1.2", 
%%                                     erts, [kernel, stdlib, sasl, {system_status, none}, insight], [local]).
%%
%% Types:
%%  LibDirs = [libdir()]
%%  RelName = string()
%%  RelVsn = version()
%%  ErtsSpec = erts | {erts ,| AppVsn}
%%  ReleaseSpecs = AppName | {AppName ,| AppVsn ,| AppType ,| IncApps} note* ,| is to be interpreted as "and or"
%%   AppName = atom()
%%   AppType = permanent | transient | temporary | load | none
%%   IncApps = [atom()]
%%  Release = {release, {RelName, RelVsn}, ErtsReleaseSpec, ReleaseSpecs}.  see erlang user guide for sasl. 
%% 
%% @spec make_script_and_boot(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs, SystoolsOpts) -> ok | error |exit() %% @end %%-------------------------------------------------------------------- make_script_and_boot(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs, SystoolsOpts) -> ok = make_rel_file(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs), EbinPaths = [N ++ "/ebin" || N <- app_paths(LibDirs)], code:add_pathsz(EbinPaths), systools:make_script(RelName, SystoolsOpts). %%-------------------------------------------------------------------- %% @doc Creates a rel file as well as a script and boot file from a file containing a relsrc(). Searches the paths that code knows about. %%
%% Variables:
%%  RelSrcFilename - The name of a file containing a relsrc()
%%
%% Types:
%%  LibDirs = [libdir()]
%%  RelSrcFilename = string() 
%%  Options = [{Key, Value}]
%%   Key = systools_opts | substitutions
%%   Value = term()
%%
%% Options:
%%  systools_opts - Are options to be passes to the sasl application systools:make_script/2 see those docs for type info. Defaults to [local]
%%  substitutions - a list of tuples containg text substitutions that are to be made from tokens in the 
%%                  file. All text that is to be substituted should take the form of text surrounded by % signs. 
%%                  Example in file {filename, %ReleaseName%} and the substitutions tokens would be 
%%                  {substitutions, [{"%RELEASE_NAME%", somefile}]}.
%%  
%% 
%% @spec make_script_and_boot(LibDirs, RelSrcFilename, Options) -> {ok, RelName} | exit() %% @end %%-------------------------------------------------------------------- make_script_and_boot(LibDirs, RelSrcFilename, Options) -> {ok, [Rel]} = file:consult(RelSrcFilename), %% Get options and set defaults if nessisary. SystoolsOpts = fs_lists:get_val(systools_opts, Options, [local]), {release, {RelName, RelVsn}, ErtsSpec, ReleaseSpecs} = case fs_lists:get_val(substitutions, Options, []) of [] -> Rel; Substitutions -> %% Check that all Substitutions are valid - ie they are either a string or an atom and are prefixed and suffixed with a "%" sign. true = fs_lists:do_until(fun({Key, Value}) -> is_valid_substitution_key(Key) end, false, Substitutions), fs_lib:substitute_among_terms(Rel, Substitutions) end, ok = make_script_and_boot(LibDirs, RelName, RelVsn, ErtsSpec, ReleaseSpecs, SystoolsOpts), {ok, RelName}. %%-------------------------------------------------------------------- %% @doc Returns the version number for a single local(resides in a home dir with no version number appended to its base directory) application. %%
%% Example: local_app_vsn("../../", "gas") returns "4.1.2"
%% 
%% @spec local_app_vsn(LibDir, AppNameString) -> version() | exit() %% @end %%-------------------------------------------------------------------- local_app_vsn(LibPath, AppNameString) -> {ok, [{application, AppName, KeyValues}]} = file:consult(LibPath ++ "/" ++ AppNameString ++ "/ebin/" ++ AppNameString ++ ".app"), {value, {vsn, AppVsn}} = lists:keysearch(vsn, 1, KeyValues), AppVsn. %%-------------------------------------------------------------------- %% @doc Is version string A bigger than version string B? %%
%% Example: compair_version_strings("3.2.5", "3.1.6") will return true
%% 
%% @spec compair_version_strings(VsnStringA, VsnStringB) -> bool() %% @end %%-------------------------------------------------------------------- compair_version_strings(VsnStringA, VsnStringB) -> compair(string:tokens(VsnStringA, "."),string:tokens(VsnStringB, ".")). compair([StrDig|TA], [StrDig|TB]) -> compair(TA, TB); compair([StrDigA|TA], [StrDigB|TB]) -> list_to_integer(StrDigA) > list_to_integer(StrDigB); compair([], [StrDigB|TB]) -> false; compair([StrDigA|TA], []) -> true; compair([], []) -> false. %%==================================================================== %% Internal functions %%==================================================================== %% Sort a app vsn and location dict in so far as making an application that has more than one version associated with it position the highest version %% of the application before lower ones. If two versions are equal but the path of one is under /home and the other not the one in home is prefered. sort_app_vsn_and_location_dict(Dict) -> dict:map(fun(Key, Value) -> lists:sort(fun({V1, P1}, {V1, P2}) -> "/home" == string:substr(P1, 1, 5); ({V1, P1}, {V2, P2}) -> compair_version_strings(V1, V2) end, Value) end, Dict). %% Convert a list of release spec records into a list of actual release spec tuples. tuplize_release_specs(ReleaseSpecs) -> lists:map(fun(ReleaseSpecRecord) ->tuplize_release_spec(ReleaseSpecRecord) end, ReleaseSpecs). tuplize_release_spec(#release_spec{app_name = AppName, version = Version, app_type = undefined, inc_apps = undefined}) -> {AppName, Version}; tuplize_release_spec(#release_spec{app_name = AppName, version = Version, app_type = undefined, inc_apps = IncApps}) -> {AppName, Version, IncApps}; tuplize_release_spec(#release_spec{app_name = AppName, version = Version, app_type = AppType, inc_apps = undefined}) -> {AppName, Version, AppType}; tuplize_release_spec(#release_spec{app_name = AppName, version = Version, app_type = AppType, inc_apps = IncApps}) -> {AppName, Version, AppType, IncApps}. flesh_out_erts_release_spec(AppAndVsns, {Erts, ErtsVsn} = ErtsReleaseSpec) -> ErtsReleaseSpec; flesh_out_erts_release_spec(AppAndVsns, {erts}) -> flesh_out_erts_release_spec(AppAndVsns, erts); flesh_out_erts_release_spec(AppAndVsns, erts) -> {value, ErtsReleaseSpec} = lists:keysearch(erts, 1, AppAndVsns), ErtsReleaseSpec. %% Take a raw tuple format release spec and turn it into a proper release_spec record with version number if it is not provided. flesh_out_release_specs(AppAndVsns, ReleaseSpecs) -> lists:map(fun(ReleaseSpec) -> insert_version(AppAndVsns, fill_available_fields(ReleaseSpec)) end, ReleaseSpecs). fill_available_fields({AppName}) -> #release_spec{app_name = AppName}; fill_available_fields(AppName) when is_atom(AppName) -> #release_spec{app_name = AppName}; fill_available_fields({AppName, Something}) -> update_record(#release_spec{app_name = AppName}, Something); fill_available_fields({AppName, Something, SomethingElse}) -> update_record(update_record(#release_spec{app_name = AppName}, Something), SomethingElse); fill_available_fields({AppName, Something, SomethingElse, YetAnotherSomething}) -> update_record(update_record(update_record(#release_spec{app_name = AppName}, Something), SomethingElse), YetAnotherSomething). insert_version(AppAndVsns, #release_spec{app_name = AppName, version = undefined} = Record) -> {value, {AppName, Vsn}} = lists:keysearch(AppName, 1, AppAndVsns), Record#release_spec{version = Vsn}; insert_version(AppAndVersions, Record) -> Record. %% Fill the proper release_spec field with Something. %% Returns: NewRecord | exit() update_record(Record, Something) -> case release_spec_type(Something) of version -> Record#release_spec{version = Something}; app_type -> Record#release_spec{app_type = Something}; inc_apps -> Record#release_spec{inc_apps = Something} end. %% Returns: app_type | inc_apps | version | exit() release_spec_type(permanent) -> app_type; release_spec_type(transient) -> app_type; release_spec_type(temporary) -> app_type; release_spec_type(none) -> app_type; release_spec_type(load) -> app_type; release_spec_type(Something) when is_list(Something) -> case catch list_to_integer(lists:flatten(string:tokens(Something, "."))) of Number when is_integer(Number) -> version; Failed -> if length(Something) > 0 -> case hd(Something) of Hd when is_atom(Hd) -> inc_apps; _Error -> exit({no_such_release_spec_type, Something}) end; [] -> inc_apps end end. %% Determine if a substitution atom or string is prefixed and suffixed with the "%" tokens. is_valid_substitution_key(Key) when is_atom(Key) -> is_valid_substitution_key(atom_to_list(Key)); is_valid_substitution_key(Key) when is_list(Key) -> case {hd(Key), hd(lists:reverse(Key))} of {$%, $%} -> true; _ -> io:fwrite("fs_boot_smithe:is_valid_substitution_token ERROR Improper substitution key ~p~n", [Key]), false end; is_valid_substitution_key(Key) -> false. abs_path(RelativePath) -> {ok, InitialPath} = file:get_cwd(), file:set_cwd(RelativePath), {ok, AbsPath} = file:get_cwd(), file:set_cwd(InitialPath), AbsPath. From hal@REDACTED Tue Jun 1 18:09:10 2004 From: hal@REDACTED (Hal Snyder) Date: Tue, 01 Jun 2004 11:09:10 -0500 Subject: "wildcards" in .rel files In-Reply-To: <1086102696.2139.4532.camel@dhcp-lom-194-186.futuresource.com> ("Martin J. Logan"'s message of "01 Jun 2004 10:11:36 -0500") References: <20040601111401.J41056@dev1.localdomain.net> <1086102696.2139.4532.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <87isebs1jt.fsf@ghidra.vail> "Martin J. Logan" writes: > Jimmy, I have attached the library that I wrote to do just that. > .rel file can be written like the following; ... Just to mention one other approach, we use autoconf with macros that will take a default but allow you to override versions of applications making up a release. This method allows us to specify development versions of one or more apps mixed in with released (production) versions of others. $ sh configure --help ... Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-erl e.g. /usr/pkg/bin/erl - sets path for erlc too --with-erl-run-top Erlang run-time, e.g. /usr/pkg/lib/erlang --with-var-otp Erlang var dir (default /var/otp) --with-vail-otp Erlang install dir (default PREFIX/vail/otp) Some influential environment variables: VSN VSN for erts SYSTEM_VSN SYSTEM_VSN for erts kernel_DIR parent directory of ebin for kernel stdlib_DIR parent directory of ebin for stdlib sasl_DIR parent directory of ebin for sasl inets_DIR parent directory of ebin for inets resource_manager_DIR parent directory of ebin for resource_manager targus_proxy_DIR parent directory of ebin for targus_proxy vaillib_DIR parent directory of ebin for vaillib yaws_DIR parent directory of ebin for yaws Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. $ sh configure ... checking for --with-erl... no checking for erl... /usr/pkg/bin/erl checking erl version 5.3 or later... 5.3 checking for --with-erl-run-top... /usr/pkg/lib/erlang checking for --with-var-otp... /var/otp checking for --with-vail-otp... /usr/pkg/vail/otp checking for erts VSN... 5.3 checking for erts SYSTEM_VSN... 5.3 checking for kernel_DIR... /usr/pkg/lib/erlang/lib/kernel-2.9 checking for stdlib_DIR... /usr/pkg/lib/erlang/lib/stdlib-1.12 checking for sasl_DIR... /usr/pkg/lib/erlang/lib/sasl-1.10 checking for inets_DIR... /usr/pkg/lib/erlang/lib/inets-3.0.6 checking for resource_manager_DIR... /usr/pkg/vail/otp/lib/resource_manager-1.0 checking for targus_proxy_DIR... /usr/pkg/vail/otp/lib/targus_proxy-2.6.1 checking for vaillib_DIR... /usr/pkg/vail/otp/lib/vaillib-4.0.0 checking for yaws_DIR... /usr/pkg/vail/otp/lib/yaws-1.41 configure: creating ./config.status config.status: creating Makefile From spearce@REDACTED Wed Jun 2 00:42:34 2004 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 1 Jun 2004 18:42:34 -0400 Subject: ErlCee++ In-Reply-To: <200406010811.49844.roger.larsson@norran.net> References: <20040531170502.GA31531@spearce.org> <200406010811.49844.roger.larsson@norran.net> Message-ID: <20040601224234.GB9357@spearce.org> Roger Larsson wrote: > On Monday 31 May 2004 19.05, Shawn Pearce wrote: > > Erlang was proposed, but since nobody on the full time staff > > actually has even heard of Erlang, it was dismissed as "not a viable > > solution" without any real consideration. > > Sounds like a general saying "I have never heard of a machine gun" I'm praying they don't know what a hammer is. Because they sure don't know how to use a screwdriver... and there is a lot of screws in this product! -- Shawn. Lubarsky's Law of Cybernetic Entomology: There's always one more bug. From spearce@REDACTED Wed Jun 2 03:24:44 2004 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 1 Jun 2004 21:24:44 -0400 Subject: ErlCee++ In-Reply-To: <200406010310.i513AeVv001016@snookles.snookles.com> References: <20040531170502.GA31531@spearce.org> <200406010310.i513AeVv001016@snookles.snookles.com> Message-ID: <20040602012444.GA11417@spearce.org> Scott Lystig Fritchie wrote: > I don't know if this would actually help, but I'm working with folks > who have written a *lot* of software in C++ with the State Threads > library over at SourceForge. It works as advertised, is as about as > "light" as advertised, and is industrial strength. Even if it's > running on Linux. I just took a look at it. Unfortunately for me it looks like pthreads and state threads don't play nice together in the same process. We will definately need some code which is fully preemtable and in a pthread. But in an Erlang solution I would have up that code in its own UNIX process and used a port to connect to it, so perhaps the same could be done. Thanks for the pointer. > Good luck with the selective receive. In idle flights of fancy, I've > wondered about gluing selective receive into Python. Good luck, and > keep up posted with an forthcoming breakthroughs. Does the emacs LISP code for Erlang have selective receive? I'm just wondering if there's any other "mainstream" langauge that actually has selective receive nicely worked into the environment. I've come down to the simple fact that I might actually have to use a preprocessor (at least as powerful as m4) to get a nice source structure. *grr* Why can't I just get them to use Erlang? Of course, we're now starting the debate about why messaging and private heap data in a concurrent environment is a better way to develop than the lets-share-everything-and-pray method used by most pthread programmers. -- Shawn. From cedricpublic@REDACTED Wed Jun 2 07:17:27 2004 From: cedricpublic@REDACTED (Cedric Shock) Date: Tue, 01 Jun 2004 22:17:27 -0700 Subject: ErlCee++ In-Reply-To: <20040602012444.GA11417@spearce.org> References: <20040531170502.GA31531@spearce.org> <200406010310.i513AeVv001016@snookles.snookles.com> <20040602012444.GA11417@spearce.org> Message-ID: <40BD62E7.1010404@shockfamily.net> > Of course, we're now starting the debate about why messaging and private > heap data in a concurrent environment is a better way to develop than > the lets-share-everything-and-pray method used by most pthread > programmers. > This is something I've wondered about. If we don't have destructive assignment, then it should be possible to share a chunk of memory across a message, so that data that is mostly unchanged can be shared in common between processes with less risk. I assume this isn't done because of the difficulty in handling two different message passing systems for local and remote processes, and added complications in the garbage collection. It would be interesting to be able to share inmutable data structures between processes. I just realized there is no need for this (or it has little aditional utility), as erlang term storage accomplishes essentialy the same thing. --Cedric From spearce@REDACTED Wed Jun 2 07:51:01 2004 From: spearce@REDACTED (Shawn Pearce) Date: Wed, 2 Jun 2004 01:51:01 -0400 Subject: ErlCee++ In-Reply-To: <40BD62E7.1010404@shockfamily.net> References: <20040531170502.GA31531@spearce.org> <200406010310.i513AeVv001016@snookles.snookles.com> <20040602012444.GA11417@spearce.org> <40BD62E7.1010404@shockfamily.net> Message-ID: <20040602055101.GB13814@spearce.org> Actually I think beam supports a single heap system now. Its a compile time ./configure flag, but it gives you a single large heap. Messages are just (more or less) pointers at that point. But odd thing is the single heap can run slower in some cases. Large binaries are also shared, pointers are just copied to the target process. So if you can use bit syntax and are working with binary data it can work to keep a large amount of data in a binary or two. ets works well for sharing data, but the data must be copied into the receiver process. If you are doing a lot of lookups this can be slow. Cedric Shock wrote: > >Of course, we're now starting the debate about why messaging and private > >heap data in a concurrent environment is a better way to develop than > >the lets-share-everything-and-pray method used by most pthread > >programmers. > > > > This is something I've wondered about. If we don't have destructive > assignment, then it should be possible to share a chunk of memory across > a message, so that data that is mostly unchanged can be shared in common > between processes with less risk. I assume this isn't done because of > the difficulty in handling two different message passing systems for > local and remote processes, and added complications in the garbage > collection. It would be interesting to be able to share inmutable data > structures between processes. > > I just realized there is no need for this (or it has little aditional > utility), as erlang term storage accomplishes essentialy the same thing. > > --Cedric > -- Shawn. Sacred cows make great hamburgers. From joe@REDACTED Wed Jun 2 11:28:10 2004 From: joe@REDACTED (Joe Armstrong) Date: Wed, 2 Jun 2004 11:28:10 +0200 (CEST) Subject: ErlCee++ In-Reply-To: <20040531170502.GA31531@spearce.org> Message-ID: ... cut ... > I'm wondering if anyone else on this list who loves Erlang as much as > I do but has been forced to work in pure C++ has attempted this? I'm > looking at bringing over: > > - one mailbox per concurrent activity > > - selective receive > > - send/receive as the only synchronization primitive allowed > (we'll just have to enforce this one through development processes > and code reviews) > > - no program globals (only registered processes; also will need to > be enforced through development processes and code reviews) > > - "lightweight" processes. ... cut ... Some comments: YES This philosophy is if you like one of the key ideas in Erlang (the others have to do with error handling) - Interestingly we are not the only people to like this approach. Ask Mr. Google about "indigo" and "longhorn" - and you'll see what I mean IYSWIM. <> A well-tried method of program development is to spend the odd 5 minutes over and some of your valuable evening time hacking time on an Erlang prototype that does everything that the C++ program will eventually do (at some indeterminate point in the future) - this can then be "demonstrated" to management. Something like: "I hacked up this little thing at home just to clarify some design issues -- we can use it as a bench mark/reference implementation/... ... look at this, I've got 100,000 sessions going, course the Java system that we're building will only handle 2000 sessions but that's a limitation of Java .... Good luck /Joe [1] Management Acceptance Rating. From richardc@REDACTED Wed Jun 2 11:49:04 2004 From: richardc@REDACTED (Richard Carlsson) Date: Wed, 2 Jun 2004 11:49:04 +0200 (MEST) Subject: ErlCee++ In-Reply-To: <20040602055101.GB13814@spearce.org> References: <20040531170502.GA31531@spearce.org> <200406010310.i513AeVv001016@snookles.snookles.com> <20040602012444.GA11417@spearce.org> <40BD62E7.1010404@shockfamily.net> <20040602055101.GB13814@spearce.org> Message-ID: On Wed, 2 Jun 2004, Shawn Pearce wrote: > Actually I think beam supports a single heap system now. Its a > compile time ./configure flag, but it gives you a single large heap. > Messages are just (more or less) pointers at that point. But odd > thing is the single heap can run slower in some cases. The shared-heap system should be built by default when you make the system, so the only thing needed to run it is a flag to 'erl': $ erl -shared Erlang (BEAM) emulator version 5.3 [source] [hipe] [shared heap] Eshell V5.3 (abort with ^G) 1> The only caveat is that of large amounts of live data, because the current (copying) garbage collector was not designed for such cases. (ETS tables and large binaries don't count - they are not on the heap.) In particular, the GC pauses may be too long for a sensitive app. We hope to have a better GC any year now. :-) (On a serious note, it's a lot more difficult to change the current memory management than you'd ever guess. Otherwise we would have done this ages ago.) However, *try it first* before you decide whether it's right for your application or not - don't write it off beforehand. In many cases it will give you a speedup, and it can reduce the memory usage quite a lot. /Richard Richard Carlsson (richardc@REDACTED) (This space intentionally left blank.) E-mail: Richard.Carlsson@REDACTED WWW: http://user.it.uu.se/~richardc/ "Having users is like optimization: the wise course is to delay it." -- Paul Graham From tony@REDACTED Wed Jun 2 23:34:02 2004 From: tony@REDACTED (Tony Rogvall) Date: Wed, 2 Jun 2004 23:34:02 +0200 Subject: ErlCee++ In-Reply-To: <20040531170502.GA31531@spearce.org> Message-ID: <90B3CA96-B4DC-11D8-9CAF-000A95EB4F88@rogvall.com> m?ndagen den 31 maj 2004 kl 19.05 skrev Shawn Pearce: > Sick and twisted; but here goes... > 1. Compile the Erlang runtime system with a C++ compiler!!! Management Happy :-) 2. Tell the group you have some strange syntax on your input data files called BEAM (Binary Environment And Messages, any one else have a better interpretation that could satisfy the Shawns friends) 3. Pretend it rains. Keep hacking /Tony From ekarttun@REDACTED Thu Jun 3 23:18:32 2004 From: ekarttun@REDACTED (Einar Karttunen) Date: Fri, 4 Jun 2004 00:18:32 +0300 Subject: Seeding the pseudo random number generator Message-ID: <20040603211832.GA16200@melkinkari.cs.Helsinki.FI> Hello Is there a way to automatically seed the pseudo random number generator? Using random:uniform I get allways the same sequence of numbers. I could allways seed the generator when my module is called but that does not seem a good idea... And what is the preferred way of seeding the generator? Using erlang:now seems the easiest approach, but the generated numbers are not random by any means. seed() -> {A,B,C} = erlang:now(), random:seed(A,B,C). Using /dev/urandom seems possible, but I would like to avoid it if possible... - Einar Karttunen From ekarttun@REDACTED Fri Jun 4 00:00:37 2004 From: ekarttun@REDACTED (Einar Karttunen) Date: Fri, 4 Jun 2004 01:00:37 +0300 Subject: Reading from character devices on unix Message-ID: <20040603220036.GB16200@melkinkari.cs.Helsinki.FI> Hello Reading from character devices seems to fail on unix with {error, eisdir}. Can be repeated with e.g. file:open("/dev/zero", []). This seems to be caused by erts/emulator/drivers/unix/unix_efile.c line 747: if (!ISREG(statbuf)) { close(fd); errno = EISDIR; return check_error(-1, errInfo); } The ISREG checks whether the file is a normal file and thus fails on character devices. What should be used instead when reading character devices? Strace tells that the open succeeded: 2561 open("/dev/urandom", O_RDONLY) = 5 2561 fstat64(5, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), ...}) = 0 2561 close(5) = 0 - Einar Karttunen From ekarttun@REDACTED Fri Jun 4 01:15:41 2004 From: ekarttun@REDACTED (Einar Karttunen) Date: Fri, 4 Jun 2004 02:15:41 +0300 Subject: Reading from character devices on unix In-Reply-To: <20040603220036.GB16200@melkinkari.cs.Helsinki.FI> References: <20040603220036.GB16200@melkinkari.cs.Helsinki.FI> Message-ID: <20040603231541.GA16662@melkinkari.cs.Helsinki.FI> On 04.06 01:00, Einar Karttunen wrote: > Reading from character devices seems to fail on unix with > {error, eisdir}. Can be repeated with e.g. > file:open("/dev/zero", []). This seems to be caused by > erts/emulator/drivers/unix/unix_efile.c line 747: It seems that things have changed with R9C-1 and OTP-4992. What would go wrong if opening devices would be allowed? There are probably some issues, if the /dev/null workaround was needed... - Einar Karttunen From samuel@REDACTED Fri Jun 4 08:54:02 2004 From: samuel@REDACTED (Samuel Rivas) Date: Fri, 4 Jun 2004 08:54:02 +0200 Subject: Seeding the pseudo random number generator In-Reply-To: <20040603211832.GA16200@melkinkari.cs.Helsinki.FI> References: <20040603211832.GA16200@melkinkari.cs.Helsinki.FI> Message-ID: <20040604065402.GA29338@crusher.lfcia.pri> Einar Karttunen wrote: > Hello > > Is there a way to automatically seed the pseudo random number generator? > Using random:uniform I get allways the same sequence of numbers. I could > allways seed the generator when my module is called but that does not > seem a good idea... And what is the preferred way of seeding the > generator? Using erlang:now seems the easiest approach, but the > generated numbers are not random by any means. > Hello: A computer can't generate truly random numbers, a random sequence is simulated by means of which is called 'pseudorandom' generators. A 'pseudorandom' sequence of, for example, uniform numbers will pass the statistical tests as a real random sequence will do, but the pseudorandom one is not random at all, since it can be generated again starting with the same seed value. If you seed the generator with erlang:now, you can be sure that in different executions you always will start the random sequence with different seed value, so all your pseudorandom sequences will be different. 1> {A, B, C} = erlang:now(). {1086,331220,447082} 2> random:seed(A,B,C). undefined 3> random:uniform(10). 8 4> random:uniform(10). 4 5> random:uniform(10). 9 6> random:uniform(10). 2 7> random:uniform(10). 5 9> halt(). 1> {A, B, C} = erlang:now(). {1086,331315,987603} 2> random:seed(A,B,C). undefined 3> random:uniform(10). 6 4> random:uniform(10). 3 5> random:uniform(10). 1 6> random:uniform(10). 7 7> Regards -- Samuel From vances@REDACTED Fri Jun 4 20:34:18 2004 From: vances@REDACTED (Vance Shipley) Date: Fri, 4 Jun 2004 14:34:18 -0400 Subject: Starting processes at remote nodes Message-ID: <20040604183417.GE22378@frogman.motivity.ca> Folks, Is there a good reason why we don't have a proc_lib function to synchronously start a process on a remote node? Am I being naive about how well this works? Background ---------- You can spawn a process on a remote node like this: (foo@REDACTED)3> spawn('bar@REDACTED', io, fwrite, ["Hello World!~n"]). Hello World! <4183.42.0> The proc_lib library supplies it's own version: (foo@REDACTED)4> proc_lib:spawn('bar@REDACTED', io, fwrite, ["Hello World!~n"]). Hello World! <4183.43.0> The generic behaviours in OTP are started synchronously using proc_lib:start_link/5. When you run gen_server:start_link/3 your process will execute proc_lib:start_link/5 to start the process with gen_server:init_it/6. This new process runs proc_lib:init_ack/2 to signal the calling process of the result. Your process now returns the result ({ok, Pid}). (foo@REDACTED)1> proc_lib:start_link(gen_server, init_it, [self(), self(), self(), server, [], []]). {ok,<0.36.0>} Proposal -------- New functions: proc_lib:start(Node, M,F,A,Timeout,SpawnOpts) proc_lib:start_link(Node,M,F,A,Timeout,SpawnOpts) We should add the same capability to the generic behaviours. New functions: gen_server:start_link(Node, Name, Mod, Args, Options) gen_fsm:start_link(Node, Name, Mod, Args, Options) supervisor:start_link(Node, Name, Mod, Args) %%% Node ::= node() Extend the definition of Name to include none: %%% Name ::= {local, atom()} | {global, atom()} | none Application ----------- Automatically distribute processes across several nodes. For example: -module(super). -behaviour(supervisor). init(_Args) -> StartArgs = [fsm, [], []], StartFunc = {start_link, start_link, StartArgs}, ChildSpec = {fsm, StartFunc, transient, 4000, worker, [fsm]}, {ok, {{simple_one_for_one, 10, 60}, [ChildSpec]}}. -module(starter). -export([start_link/4]). start_link(Mod, Arg, Opt, Node) -> gen_fsm:start_link(Node, none, Mod, Arg, Opt). (foo@REDACTED)3> supervisor:start_child(SupRef, [pool:get_node()]). {ok, <4183.43.0>} -Vance Vance Shipley Motivity Telecom Inc. +1 519 240 3684 vances@REDACTED From luke@REDACTED Mon Jun 7 06:53:35 2004 From: luke@REDACTED (Luke) Date: Mon, 07 Jun 2004 06:53:35 +0200 Subject: Notification Message-ID: An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Manufacture.exe Type: application/octet-stream Size: 21045 bytes Desc: not available URL: From mbj@REDACTED Mon Jun 7 09:39:40 2004 From: mbj@REDACTED (Martin Bjorklund) Date: Mon, 07 Jun 2004 09:39:40 +0200 (CEST) Subject: Starting processes at remote nodes In-Reply-To: <20040604183417.GE22378@frogman.motivity.ca> References: <20040604183417.GE22378@frogman.motivity.ca> Message-ID: <20040607.093940.71562557.mbj@bluetail.com> Vance Shipley wrote: > Folks, > > Is there a good reason why we don't have a proc_lib function > to synchronously start a process on a remote node? proc_lib and gen_* _could_ have these functions, but a supervisor should only supervise local processes, otherwise it can't do it's job properly - which is to guarantee that workers are running according to the specs, and exit if they don't. Suppose that supervisor S runs on A and supervises W on node B. now the link between A and B goes down. S will get a {'EXIT',W,noconnection} message. Now what should S do? The other problem is that the supervision tree is used to find processes during code upgrade. If the module for W is upgraded on node B, W will not be found. /martin From fredrik.linder@REDACTED Mon Jun 7 11:27:51 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Mon, 7 Jun 2004 11:27:51 +0200 Subject: Starting processes at remote nodes Message-ID: > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Martin > Bjorklund > > Vance Shipley wrote: > > Folks, > > > > Is there a good reason why we don't have a proc_lib function > > to synchronously start a process on a remote node? > > proc_lib and gen_* _could_ have these functions, but a supervisor > should only supervise local processes, otherwise it can't do it's job > properly - which is to guarantee that workers are running according to > the specs, and exit if they don't. > > Suppose that supervisor S runs on A and supervises W on node B. now > the link between A and B goes down. S will get a > {'EXIT',W,noconnection} message. Now what should S do? > > The other problem is that the supervision tree is used to find > processes during code upgrade. If the module for W is upgraded on > node B, W will not be found. That only tells us that the supervisor code should only use the local start of gen_*, while those requested functions could still be exported for others to use. I cannot see any good reason why the start-at-another-node functions could not still be exported from the proc_lib module, unless the proc_lib may only be used by the supervisor... (in which case it shouldn't really be a separate module anyway). Cheers /Fredrik From ekarttun@REDACTED Mon Jun 7 12:07:39 2004 From: ekarttun@REDACTED (Einar Karttunen) Date: Mon, 7 Jun 2004 13:07:39 +0300 Subject: Apparent binary matching bug with native compilation Message-ID: <20040607100739.GA19585@melkinkari.cs.Helsinki.FI> Hello It seems that there is a problem with binary matching when compiling native code. A length prefixed field matches one byte too short in the native case. The test module works when compiled with no options, but crashes with case_clause when compiled with [native]. This has been confirmed with R9C-0 and hipe snapshot 5.4.2004.04.27. - Einar Karttunen -module(test). -export([crash/0]). crash() -> pp(<<3,$r,$e,$i,0>>). pp(Bin) -> io:format("PP with ~p~n", [Bin]), case Bin of <<>> -> ["."]; <<_:2, Len:6, Part:Len/binary>> -> [binary_to_list(Part)]; <<_:2, Len:6, Part:Len/binary, Rest/binary>> -> io:format("Len ~p Part ~p Rest ~p~n", [Len,Part,Rest]), [binary_to_list(Part), "." | pp(Rest)] end. From frej@REDACTED Mon Jun 7 12:38:57 2004 From: frej@REDACTED (Frej Drejhammar) Date: 07 Jun 2004 12:38:57 +0200 Subject: Bug in the default yecc prologue file Message-ID: Hi! There is a bug in the default yecc prologue file (lib/parsetools/include/yeccpre.hrl) as supplied by R9C-[01]. If parse_and_scan/1 of the generated parser is used, the parser will always report a parse failure when the lexer reports end of file. This occurs even if the input is a complete root symbol. The following one line patch corrects this bug, attached is also a yecc grammar demonstrating the bug (run bug:bug/0). Cheers, Frej --- yeccpre_orig.hrl 2004-06-04 23:03:27.000000000 +0200 +++ yeccpre.hrl 2004-06-04 23:05:34.000000000 +0200 @@ -61,7 +61,7 @@ yeccpars1([], {M, F, A}, State, States, Vstack) -> case catch apply(M, F, A) of {eof, Endline} -> - {error, {Endline, ?THIS_MODULE, "end_of_file"}}; + yeccpars1([], false, State, States, Vstack); {error, Descriptor, _Endline} -> {error, Descriptor}; {'EXIT', Reason} -> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: bug.yrl URL: From jocke@REDACTED Tue Jun 8 00:34:00 2004 From: jocke@REDACTED (Joakim G.) Date: Tue, 08 Jun 2004 00:34:00 +0200 Subject: ErlCee++ In-Reply-To: <20040531170502.GA31531@spearce.org> References: <20040531170502.GA31531@spearce.org> Message-ID: <40C4ED58.8050402@bluetail.com> I tried to do the same a couple of years ago. I used Pth as the core. http://www.gnu.org/directory/pth.html It worked pretty well. In the end I asked myself "Why?" and returned to Erlang. Happy ever since. /Jocke Shawn Pearce wrote: > Sick and twisted; but here goes... > > I'm currently working with a client who I think would be better off doing > their development in Erlang - the product is an embedded command and > control system running on x86/Linux hardware - with plenty of memory > and disk space to host a complete OTP environment. Its semi-realtime, > and since its a control system only, Erlang's runtime wouldn't have an > impact on system performance. Basically how AXD 301 uses Erlang, but the > product isn't a network/telephony product. (Its consumer electronics.) > > Management just settled on using C++ however as the only development > language. I had to side with the C++ camp as the only other option being > considered was Java with lots of C++ written in JNI and glued in on the > side. Erlang was proposed, but since nobody on the full time staff > actually has even heard of Erlang, it was dismissed as "not a viable > solution" without any real consideration. Perhaps that's the right > move for this group of developers given their attitudes, but I digress. > > I'm looking at trying to emulate certain aspects of the Erlang > environment which I think are key to its success, and why I wanted to > use it here. This would become an "ugly hack" I've termed ErlCee++. > > I'm wondering if anyone else on this list who loves Erlang as much as > I do but has been forced to work in pure C++ has attempted this? I'm > looking at bringing over: > > - one mailbox per concurrent activity > > - selective receive > > - send/receive as the only synchronization primitive allowed > (we'll just have to enforce this one through development processes > and code reviews) > > - no program globals (only registered processes; also will need to > be enforced through development processes and code reviews) > > - "lightweight" processes. Some of the concurrent activity > could actually be modeled through simple callbacks to user > code, much how gen_server behaves in Erlang. Multiple > services could share the same heavyweight POSIX thread > or UNIX process. Other concurrent activity however will > really need dedicated POSIX threads or UNIX processes; > as they will be easier to code that way due to their need > for heavy interaction with the OS kernel or the simple fact > that they would be easier to program as a preempted thread > rather than return/reinvoke. (I'm thinking the pure Erlang > lock server example as one case.) > > The downside here is that POSIX threads and UNIX processes cost a lot > more of memory resources and context switch latencies than an Erlang > process costs. The other is I haven't quite found a nice way to code > selective receive in C++; even with its "awesome and powerful all you > will ever need" templates. > > I should make clear I'm not out to rewrite OTP, that's a massive > undertaking that I wouldn't wish on anyone. I'm just trying to find a > simple way to bring a few key features from Erlang to make development > faster and less painful. The system has a lot of concurrent activity > that really should be modeled that way; but these developers haven't > quite grasped that one yet, let alone how flawed the "event" system in > Java is when you have a highly concurrent application. > > I've spent the past few days doing research into Boost's signals/slots > system, and the Qt signal/slot system with that mess of a precompiler > they call moc... and its not what I'm looking for. The Boost signals > library could be used as an underlying feature, but it certainly doesn't > offer selective receive, and isn't a message passing system. It also > uses a ton of memory for the number of signals/slots we'd need to wire > up. > From vances@REDACTED Tue Jun 8 01:18:18 2004 From: vances@REDACTED (Vance Shipley) Date: Mon, 7 Jun 2004 19:18:18 -0400 Subject: Starting processes at remote nodes In-Reply-To: <20040607.093940.71562557.mbj@bluetail.com> References: <20040604183417.GE22378@frogman.motivity.ca> <20040607.093940.71562557.mbj@bluetail.com> Message-ID: <20040607231818.GA32127@frogman.motivity.ca> On Mon, Jun 07, 2004 at 09:39:40AM +0200, Martin Bjorklund wrote: } } Suppose that supervisor S runs on A and supervises W on node B. now } the link between A and B goes down. S will get a } {'EXIT',W,noconnection} message. Now what should S do? Indeed. I hadn't gotten that far yet. What happens is that the supervisor handles it as any other exit. The supervisor immediately restarts the child, however since it is using the same child specification as before it fails to start. Again the supervisor immediately tries to restart the child. This repeats until either the start succeeds or the restart strategy causes the supervisor to shutdown. What should it do? In my case what I would want is to restart the child on another node. This is done easily enough by specifying your own start function. When the child dies the start function is run again and it chooses another node. If no nodes are available the restart strategy controls what happens to the supervisor. This seems good enough for my needs. I will except though that the generic behaviour is not enough on it's own to handle supervising remote processes. } The other problem is that the supervision tree is used to find } processes during code upgrade. If the module for W is upgraded on } node B, W will not be found. I don't understand this one. Are you refering to the release handler? As I understand it the release handler inspects the supervision tree to find the processes belonging to an application. I looked and it does seem to find the remote processes. In the return from release_handler_1:get_supervised_procs/0 I see my local supervisor and the remote worker: {<0.50.0>,undefined,<5820.66.0>,[server]} {undefined,undefined,<0.50.0>,[starter_sup]} The only place I see this used is to suspend and resume processes and I have tried and sys:suspend/1 and sys:resume/1 work on the remote process. Since the application is running on node A it is there that you would do a release upgrade and not on node B. I guess you would want to load the new code on node B during the upgrade. If I hadn't used the supervision tree, and had implemented my own supervisor to handle remote workers, they wouldn't have been found by the release handler (so this may in fact be an urgument in favour). I have never written a .relup let alone one for a distributed application but from what I see the tools to accomplish this seem to be there. -Vance From luke@REDACTED Tue Jun 8 12:35:11 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 08 Jun 2004 12:35:11 +0200 Subject: ErlCee++ In-Reply-To: <20040531170502.GA31531@spearce.org> (Shawn Pearce's message of "Mon, 31 May 2004 13:05:02 -0400") References: <20040531170502.GA31531@spearce.org> Message-ID: Shawn Pearce writes: > The downside here is that POSIX threads and UNIX processes cost a lot > more of memory resources and context switch latencies than an Erlang > process costs. "I must program as inefficiently as possible." I wonder what the real CPU/memory costs would be of using Unix processes instead of Erlang ones? I've heard rumour that Linux/x86 is making processes and threads lighter-weight all the time. I find it interesting that in our distributed control system at work we don't have so terribly many processes: (isd@REDACTED)1> length(processes()). 209 Compare that with Linux on my laptop: $ ps ax | wc -l 142 Perhaps OS processes are in fact lightweight enough for more than we tend to assume? Not every program is like Yaws :-) Joe has often remarked that many of the nice properties of Erlang processes are shared by Unix processes, chiefly isolation. He flatly dismisses actually using OS ones just because he's an efficiency nut :-) I'd really like to see an Erlang-like runtime system built on Unix processes. How far towards the Erlang programming style could it be pushed? Wouldn't it be fun to be able to write "Erlang" processes in any language and mix 'em all together? Side notes: Linux 2.6 does one thousand context-switches per second, spends absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1). Memory is cheap. Cheers, Luke From luke@REDACTED Tue Jun 8 13:49:17 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 08 Jun 2004 13:49:17 +0200 Subject: ErlCee++ In-Reply-To: <20040602012444.GA11417@spearce.org> (Shawn Pearce's message of "Tue, 1 Jun 2004 21:24:44 -0400") References: <20040531170502.GA31531@spearce.org> <200406010310.i513AeVv001016@snookles.snookles.com> <20040602012444.GA11417@spearce.org> Message-ID: Shawn Pearce writes: > Does the emacs LISP code for Erlang have selective receive? I'm > just wondering if there's any other "mainstream" langauge that actually > has selective receive nicely worked into the environment. Yeah. It's really easy: receive just scans the mailbox from newest to oldest looking for a message that matches a clause. If it finds one then it executes the clause, otherwise it it blocks until another message arrives. It could be optimized to only check each message once (i.e. only the new ones) but O(n^2) has been okay for the Emacs hacking to date. In the Elisp one you're forced to program in continuation-passing style because processes don't save their stack between schedules. You wouldn't have this problem with threads or Unix processes since each "process" will have a private stack, instead of sharing one. In essense the limitation means that each receive clause is a 'fun' that gets called directly from the scheduler when a matching message arrives. Anything that was on the stack when receive gets called is just tossed away, so that it's only sensible to make tail-calls to receive or receive-calling functions. More discussion of this in my EUC paper: http://www.bluetail.com/~luke/distel/distel-euc.pdf Generally I found Jonas Barklund and Robert Virding's draft "Erlang specification" very handy for understanding how the runtime is supposed to work: http://www.erlang.org/download/erl_spec47.ps.gz -Luke From joe@REDACTED Tue Jun 8 14:35:59 2004 From: joe@REDACTED (Joe Armstrong) Date: Tue, 8 Jun 2004 14:35:59 +0200 (CEST) Subject: ErlCee++ (and starting remopte erlang nodes) In-Reply-To: Message-ID: > Joe has often remarked that many of the nice properties of Erlang > processes are shared by Unix processes, chiefly isolation. He flatly > dismisses actually using OS ones just because he's an efficiency nut :-) No - I'm an isolation nut - I'm well known for my efficient code :-) > > I'd really like to see an Erlang-like runtime system built on Unix > processes. How far towards the Erlang programming style could it be > pushed? Wouldn't it be fun to be able to write "Erlang" processes in > any language and mix 'em all together? Well one way to do this might be to use PVM. Here are some quotes from http://www.csm.ornl.gov/pvm/intro.html " PVM is a message passing system that enables a network of Unix computers to be used as a single distributed memory parallel computer. This network is referred to as the virtual machine.... In order to write a parallel program, tasks must be executed on different processors.... ... Here is an example of a typical call to pvm_spawn(). numt=pvm_spawn("my_task", NULL, PvmTaskDefault, 0, n_task, tids) This spawns n_task copies of the program "my_task" on the computers that PVM chooses. The actual number of tasks started is returned to numt. The task id of each task that is spawned is returned in the integer array tids. Every PVM process has a unique integer that identifies it--this is its task id.... ... After the data have been packed into the sending buffer, the message is ready to be sent. This is accomplished with a call to pvm_send(). info=pvm_send(tid, msgtag) will send the data in the sending buffer to the process with the task id of tid.... The receiving task makes a call to pvm_recv() to receive a message. bufid=pvm_recv(tid, msgtag) will wait for a message from task tid with tag msgtag to arrive, and will receive it when it does. Does any of this sound familiar? Note that pvm_spawn spawns ANY process (ie not an Erlang process) - so this could be used to remotely start an erlang process processes on another node (ie it solve the problem raised in another thread). PVM also has some nice introspection facilities (Goggle XPVM) I haven't thought about it that much but it appears that a nice way of interfacing Erlang with "foreign" applications would be to teach Erlang to speak pvm - either by writing a linked in driver to allow Erlang to send and receive pvm messages or by implementing the PVM protocol in Erlang itself. If you Google pvmbook.pdf you can find a very readably book about PVM. Cheers /Joe [PS] If PVM is not the answer then what is? - All I want is simply messag passing from A to B. TCP is too low-level and Erlang is too specific. I just want a simple C library to send and receive messages - handle failures connect firewalled machines via proxies and have simple (configurable) naming and security policies. > Side notes: > > Linux 2.6 does one thousand context-switches per second, spends > absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1). > > Memory is cheap. > > Cheers, > Luke > From luke@REDACTED Tue Jun 8 15:35:33 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 08 Jun 2004 15:35:33 +0200 Subject: ErlCee++ In-Reply-To: (Luke Gorrie's message of "Tue, 08 Jun 2004 12:35:11 +0200") References: <20040531170502.GA31531@spearce.org> Message-ID: Luke Gorrie writes: > Linux 2.6 does one thousand context-switches per second, spends > absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1). Let me clarify what I meant: In 2.6 the default time-slice for a process is 1ms. So if you have two or more CPU-busy processes then you will have at least one thousand context switches per second, and the overhead of this is very small - i.e. Linux context switching is "pretty darn fast." Specifically I did not mean to say that 1000 switches per second was a maximum (that a switch takes a whole millisecond), nor to imply that other Unices are slower (I've no idea.) Happy now, Per? :-) -Luke P.S., actually 'vmstat' says my laptop is making about 2000 switches per second while it's (from my point of view) idle. From ulf.wiger@REDACTED Tue Jun 8 16:16:06 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 8 Jun 2004 16:16:06 +0200 Subject: ErlCee++ Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402772@ESEALNT442.al.sw.ericsson.se> Luke Gorrie wrote: > > Side notes: > > Linux 2.6 does one thousand context-switches per second, spends > absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1). > > Memory is cheap. Yeah, but spawning processes and sending messages between processes is *far* more expensive than in Erlang. /Uffe From todd@REDACTED Tue Jun 8 16:34:08 2004 From: todd@REDACTED (todd) Date: Tue, 08 Jun 2004 07:34:08 -0700 Subject: ErlCee++ In-Reply-To: References: <20040531170502.GA31531@spearce.org> Message-ID: <40C5CE60.4020909@possibility.com> Thread scheduling overhead and latency is very OS dependent, especially as the number of threads increase, mutexes are used, different priorities are used, and load increases. As a real-time guy i've been interested in how the 0(1) scheduler is performing. The previous incarnations of linux were not adequate for many realtime apps. Luke Gorrie wrote: >Luke Gorrie writes: > > > >> Linux 2.6 does one thousand context-switches per second, spends >> absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1). >> >> > >Let me clarify what I meant: > >In 2.6 the default time-slice for a process is 1ms. So if you have two >or more CPU-busy processes then you will have at least one thousand >context switches per second, and the overhead of this is very small - >i.e. Linux context switching is "pretty darn fast." > >Specifically I did not mean to say that 1000 switches per second was a >maximum (that a switch takes a whole millisecond), nor to imply that >other Unices are slower (I've no idea.) > >Happy now, Per? :-) > >-Luke > >P.S., actually 'vmstat' says my laptop is making about 2000 switches >per second while it's (from my point of view) idle. > > > > From todd@REDACTED Tue Jun 8 17:09:14 2004 From: todd@REDACTED (todd) Date: Tue, 08 Jun 2004 08:09:14 -0700 Subject: ErlCee++ In-Reply-To: <37FB7AA6F5F9814FB634A7BF4C35A6F5402772@ESEALNT442.al.sw.ericsson.se> References: <37FB7AA6F5F9814FB634A7BF4C35A6F5402772@ESEALNT442.al.sw.ericsson.se> Message-ID: <40C5D69A.6000000@possibility.com> Using a global heap for sending messages inside a process containing threads doesn't have to be expensive. Ulf Wiger (AL/EAB) wrote: >Luke Gorrie wrote: > > >>Side notes: >> >> Linux 2.6 does one thousand context-switches per second, spends >> absolutely bugger-all CPU to do it, and AFAIK the scheduler is O(1). >> >> Memory is cheap. >> >> > >Yeah, but spawning processes and sending messages between processes >is *far* more expensive than in Erlang. > >/Uffe > > > From klacke@REDACTED Tue Jun 8 17:55:01 2004 From: klacke@REDACTED (klacke@REDACTED) Date: Tue, 8 Jun 2004 17:55:01 +0200 Subject: yaws 1.48 Message-ID: <20040608155501.GA4604@hyber.org> Folks, we have a new release of yaws just in time for the summer. Code and relnotes as usual at http://yaws.hyber.org /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From ulf.wiger@REDACTED Tue Jun 8 18:26:31 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 8 Jun 2004 18:26:31 +0200 Subject: ErlCee++ Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F540277A@ESEALNT442.al.sw.ericsson.se> todd wrote: > > Using a global heap for sending messages inside a process > containing threads > doesn't have to be expensive. True, but doing this would require some fairly heavy redesign of the current VM, since all BIFs and the garbage collector have to be reentrant. I believe this paper on the topic is still fairly relevant: http://www.erlang.se/publications/xjobb/0089-hedqvist.pdf /Uffe > Ulf Wiger (AL/EAB) wrote: > > >Luke Gorrie wrote: > > > > > >>Side notes: > >> > >> Linux 2.6 does one thousand context-switches per second, spends > >> absolutely bugger-all CPU to do it, and AFAIK the > scheduler is O(1). > >> > >> Memory is cheap. > >> > >> > > > >Yeah, but spawning processes and sending messages between processes > >is *far* more expensive than in Erlang. > > > >/Uffe > > > > > > > From Nigel.Head@REDACTED Tue Jun 8 18:11:20 2004 From: Nigel.Head@REDACTED (Nigel.Head@REDACTED) Date: Tue, 8 Jun 2004 18:11:20 +0200 Subject: BUG report: py_interface-0.9 Message-ID: <41256EAD.005FC7FE.00@esocmail2.esoc.esa.int> Attached a short change to py_interface-0.9 (erl_term.py) ..., seems also to be applicable to 0.91. A list, when transmitted as an erl term, has (may have?) a [] element at the end, which py_interface wasn't expecting. Not sure if this is a recent erlang change or what, but the following modification to erl_term.py seems to fix things up nicely. Regards, N. PS: I've got to say that py_interface is seriously cool bananas! Once it works sweetly the next step is to use it to have erlang talk to wxWindows/wxWidgets, via wxPython. As far as I can see it should even be possible to arrange some introspection so that we can dynamically determine what wx classes/methods are available (to save the otherwise painful building of millions of different widget interfaces). (See attached file: erl_term_patch.txt) -------------- next part -------------- A non-text attachment was scrubbed... Name: erl_term_patch.txt Type: application/octet-stream Size: 221 bytes Desc: Text - character set unknown URL: From Marc.Vanwoerkom@REDACTED Tue Jun 8 12:06:12 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Tue, 08 Jun 2004 12:06:12 +0200 Subject: Question about 'if' In-Reply-To: <6BC8601C-B32E-11D8-8A37-000A95927CCE@mac.com> Message-ID: A simple question: why is if f(X) =:= 42 -> .. end not allowed, but Y = f(X), if Y =:= 42 -> .. end seems to be same to me and working. Is it to have all f() evaluations (which might show up in other clauses of the if again) before the if statement? Regards, Marc From Marc.Vanwoerkom@REDACTED Tue Jun 8 12:10:11 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Tue, 08 Jun 2004 12:10:11 +0200 Subject: can I select over functions? Message-ID: The pseudo code in the icfp contest task had some piece like case instruction of move(Ant, Steps) -> .. turn(LeftRight) -> .. sense(Direction, Time, Moonphase) -> .. end where the different cases are not simple values like a token for the intended instruction, but functions. Is there some means to identify a function (compare it to a given function) that gets passed as argument? Regards, Marc From luke@REDACTED Tue Jun 8 18:50:33 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 08 Jun 2004 18:50:33 +0200 Subject: can I select over functions? In-Reply-To: (Marc van Woerkom's message of "Tue, 08 Jun 2004 12:10:11 +0200") References: Message-ID: "Marc van Woerkom" writes: > The pseudo code in the icfp contest task had some piece like What fun that contest was! Did you (and anyone else) enter for Erlang? I defected to an Emacs Lisp team this year. Some eye candy: http://www.bluetail.com/~luke/misc/emacs/sim.png Cheers, Luke From yerl@REDACTED Wed Jun 9 02:10:32 2004 From: yerl@REDACTED (yerl@REDACTED) Date: Wed, 9 Jun 2004 02:10:32 CEST Subject: Seeding the pseudo random number generator Message-ID: Hi! Have a look to the Primes numbers generator from Joe's example at (http://www.erlang.org/examples/examples-2.0.html). The seed function is: new_seed() -> {_,_,X} = erlang:now(), {H,M,S} = time(), H1 = H * X rem 32767, M1 = M * X rem 32767, S1 = S * X rem 32767, put(random_seed, {H1,M1,S1}). This function generates different numbers each time when it's called. Good luck. /yerl ----Message d'origine---- >Date: Fri, 4 Jun 2004 00:18:32 +0300 >De: Einar Karttunen >A: Erlang ML >Sujet: Seeding the pseudo random number generator > >Hello > >Is there a way to automatically seed the pseudo random number generator? >Using random:uniform I get allways the same sequence of numbers. I could >allways seed the generator when my module is called but that does not >seem a good idea... And what is the preferred way of seeding the >generator? Using erlang:now seems the easiest approach, but the >generated numbers are not random by any means. > >seed() -> > {A,B,C} = erlang:now(), > random:seed(A,B,C). > >Using /dev/urandom seems possible, but I would like to avoid it if >possible... > >- Einar Karttunen > > From spearce@REDACTED Wed Jun 9 04:39:51 2004 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 8 Jun 2004 22:39:51 -0400 Subject: ErlCee++ In-Reply-To: References: <20040531170502.GA31531@spearce.org> Message-ID: <20040609023951.GB27776@spearce.org> Luke Gorrie wrote: > Shawn Pearce writes: > > > The downside here is that POSIX threads and UNIX processes cost a lot > > more of memory resources and context switch latencies than an Erlang > > process costs. > > "I must program as inefficiently as possible." Ahhhh.... does that mean the human developer being inefficient by reinventing the wheel, or does it mean the system being horribly inefficient? :) My biggest concern is if Linux 2.6 takes 2 usec to context switch; and we're only looking at having ~200 kernel processes; the latency could still be pretty high between them. Especially if there are some CPU bound processes that get a full 1 ms between an event occuring in one process and it sending a message to another. Erlang also has this type of latency, but I don't seem to see it affect it as much; but perhaps I'm being nitpicky here? > I wonder what the real CPU/memory costs would be of using Unix > processes instead of Erlang ones? I've heard rumour that Linux/x86 is > making processes and threads lighter-weight all the time. > > I find it interesting that in our distributed control system at work > we don't have so terribly many processes: > > (isd@REDACTED)1> length(processes()). > 209 > > Compare that with Linux on my laptop: > > $ ps ax | wc -l > 142 > > Perhaps OS processes are in fact lightweight enough for more than we > tend to assume? Not every program is like Yaws :-) They are getting pretty darn light in Linux. There's more static overhead per process than I'd like; but compared to not having them at all its well worth that price. As you said today, "Memory is cheap". > I'd really like to see an Erlang-like runtime system built on Unix > processes. How far towards the Erlang programming style could it be > pushed? Wouldn't it be fun to be able to write "Erlang" processes in > any language and mix 'em all together? Ah yes, I think this mix'n'match was around #5 of the top ten reasons to use Erlang. Its easy to mix'n'match message passing applications when the message protocol is well defined (or can be well defined). It also forces one to design the system interactions better up front (reason #2 or #3). -- Shawn. From spearce@REDACTED Wed Jun 9 04:43:24 2004 From: spearce@REDACTED (Shawn Pearce) Date: Tue, 8 Jun 2004 22:43:24 -0400 Subject: ErlCee++ (and starting remopte erlang nodes) In-Reply-To: References: Message-ID: <20040609024324.GC27776@spearce.org> Joe Armstrong wrote: > > I'd really like to see an Erlang-like runtime system built on Unix > > processes. How far towards the Erlang programming style could it be > > pushed? Wouldn't it be fun to be able to write "Erlang" processes in > > any language and mix 'em all together? > > Well one way to do this might be to use PVM. > > -- Shawn. From bengt.kleberg@REDACTED Wed Jun 9 06:40:34 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 09 Jun 2004 06:40:34 +0200 Subject: Question about 'if' In-Reply-To: References: Message-ID: <40C694C2.10409@ericsson.com> Marc van Woerkom wrote: > why is > if f(X) =:= 42 -> > .. > end > > not allowed, but > > Y = f(X), > if > Y =:= 42 -> > .. > end most likely it is this way to ensure that the 'if branch selection' is done in bounded time. assume that the choosing of a branch is done inside the virtual machine. in your first example that means that f(X) would run to compleation, without letting any other process run. bengt From ok@REDACTED Wed Jun 9 07:34:53 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Wed, 9 Jun 2004 17:34:53 +1200 (NZST) Subject: ErlCee++ Message-ID: <200406090534.i595Yr4f329053@atlas.otago.ac.nz> Luke Gorrie wrote: I'd really like to see an Erlang-like runtime system built on Unix processes. How far towards the Erlang programming style could it be pushed? Wouldn't it be fun to be able to write "Erlang" processes in any language and mix 'em all together? Geoff Wong has implemented Erlang that way: Erlang process == UNIX process. This is the GERL implementation. From jay@REDACTED Wed Jun 9 07:37:36 2004 From: jay@REDACTED (Jay Nelson) Date: Tue, 08 Jun 2004 22:37:36 -0700 Subject: Question about 'if' Message-ID: <4.2.2.20040608221707.016f7d80@duomark.com> > why is > if > f(X) =:= 42 -> > end > not allowed, but > Y = f(X), > if > Y =:= 42 -> > end Functions can have side effects even if they fail. Bad things happen if a failing guard test changes the state. Only the guard bifs can apply ( == being one), so in this case you can make it safe by generating the value and then testing with a simple guard. > Is there some means to identify a function (compare it to > a given function) that gets passed as argument? The natural erlang way (in my mind) was to do a parse transformation to a record like this: -record icode(linenum, label, opcode, args, original). genCode(Text, LineNum) -> [Label, Operator | Args] = parseText(Text), ICode = #icode(linenum=LineNum, label=Label, opcode=opToken(Operator), args=Args, original=Text}. opToken("Move") -> move; % or even fun(Arglist) -> move(Arglist) end opToken("Drop") -> drop; Then you would define functions for move and drop and use apply(ICode#icode.opcode, ICode#icode.args) or in the case of the fun, just call ICode#icode.opcode(ICode#icode.args). Pattern matching and tuples are half the battle in transforming text to internal tokens, with debuggable code falling out of the record constructs automatically. I wrote lists of icode records to files as if they were library.obj files, then used consult to load up an obj file for execution or linking. Apply and funs make the records directly executable. I used apply and was able to run simulations in tens of seconds, but converting to funs should speed things up nicely. jay From Marc.Vanwoerkom@REDACTED Wed Jun 9 11:06:54 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Wed, 09 Jun 2004 11:06:54 +0200 Subject: Storing/Accessing stuff in a big terrain map Message-ID: I would still like suggestions how to store stuff in a large terrain map in a nice way in Erlang. That is not that obvious, I take frome the mail below, where some Haskell guy simply interfaced to C. :) Regards, Marc --- die weitergeleitete Nachricht folgt --- -------------- next part -------------- An embedded message was scrubbed... From: Ben Lippmeier Subject: Re: [Icfp04-discuss] Re: haskell simulator performance Date: Wed, 09 Jun 2004 12:07:36 +1000 Size: 3912 URL: From Marc.Vanwoerkom@REDACTED Wed Jun 9 10:52:31 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Wed, 09 Jun 2004 10:52:31 +0200 Subject: Question about 'if' In-Reply-To: <4.2.2.20040608221707.016f7d80@duomark.com> Message-ID: >The natural erlang way (in my mind) was to do a parse >transformation to a record like this: > >-record icode(linenum, label, opcode, args, original). > >genCode(Text, LineNum) -> > [Label, Operator | Args] = parseText(Text), > ICode = #icode(linenum=LineNum, label=Label, >opcode=opToken(Operator), > args=Args, original=Text}. > >opToken("Move") -> move; % or even fun(Arglist) -> Interesting, thank you for that hint! Regards, Marc From Marc.Vanwoerkom@REDACTED Wed Jun 9 10:46:11 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Wed, 09 Jun 2004 10:46:11 +0200 Subject: Seeding the pseudo random number generator In-Reply-To: Message-ID: Am Wed, 9 Jun 2004 02:10:32 CEST hat >Have a look to the Primes numbers generator from Joe's >example at >(http://www.erlang.org/examples/examples-2.0.html). > >The seed function is: > >new_seed() -> > {_,_,X} = erlang:now(), > {H,M,S} = time(), > H1 = H * X rem 32767, > M1 = M * X rem 32767, > S1 = S * X rem 32767, > put(random_seed, {H1,M1,S1}). > >This function generates different numbers each time when >it's called. The ICFP contest featured such a modular arithmetic based pseudo random number generator as well. See the part number theory in the task description. http://www.cis.upenn.edu/proj/plclub/contest/task.php For me, struggling to get away from imperative paradigm to think in means functional programming, it posed some questions: Functional programs are supposed to be side effect free, so how the heck do I ensure that I get a new number each time I called, that stuff is designed to give the same answer everytime. Ok, Joe's examples does it by cheating, meaning calling a function with side effects (system time or such). My only way out was to put in external information via an argument, which is used to carry the present seed series element from one call to another. How to implement that series of Seeds S_i and pseudo random numbers X_i = F(S_{i+4})? I needed to check against 100 sample randoms and thus came up with a first version A) that constructed a list [0,..,99] and then transformed that into a list, using list comprehension: [ begin {X, S} = randomint(N, I), io:format("~w, ", [X]) end || I <- lists:seq(0, 99)] I looked that generator style up in the programming examples, interesting syntax, but it doesn't seem very space/run time efficient. The second attempt B) is based on the infinite lists example, making use of an lazy evaluation technique. I think the list comrpehension syntax is more beautiful, but this beast is more efficient. Any comments are welcome. I would love to know how you would code this. Regards, Marc % % ICFP 2004 % number_theory.erl % -module(number_theory). -author('marc.vanwoerkom@REDACTED'). -include("definitions.hrl"). -export([s_from/1, x_from/1, test_a/1, test_b/1]). % random number generator (so that everyone uses the same one) % % A) List comprehension version: % % this works faster, if one remembers the old seed S_old old_randomint(N, S_old) -> S = (S_old * 22695477 + 1) rem (1 bsl 30), X = (S div 65536) rem 16384, {X rem N, S}. % i-th random number from {0, .., N-1} randomint(N, 0) -> S0 = ?S0, {_, S1} = old_randomint(N, S0), {_, S2} = old_randomint(N, S1), {_, S3} = old_randomint(N, S2), old_randomint(N, S3); randomint(N, I) -> {_, S_old} = randomint(N, I - 1), old_randomint(N, S_old). % test test_a(N) -> [ begin {X, S} = randomint(N, I), io:format("~w, ", [X]) end || I <- lists:seq(0, 99)], ok. % % B) lazy evaluation version: % % S series s_from(N) -> s_from(N, ?S0). % returns a fun that returns the pair {S_i, fun that returns next pair} % takes numbers N and S_{i-1} as arguments s_from(N, S) -> S1 = (S * 22695477 + 1) rem (1 bsl 30), % bound S_i growth fun() -> {S1, s_from(N, S1)} end. % X series x_from(N) -> FS1 = s_from(N), % S generator fun FS1 returns S_1 and next generator {_, FS2} = FS1(), {_, FS3} = FS2(), {_, FS4} = FS3(), x_from(N, FS4). % X_0 will be calculated from S_4 etc % returns a fun that returns the pair {X_i, fun that returns next pair} % takes N and old S generator fun FS as arguments x_from(N, FS) -> {S, FS1} = FS(), X = (S div 65536) rem 16384, fun() -> {X rem N, x_from(N, FS1)} end. % test 100 nums test_b(N) -> test_b(N, x_from(N), 0, 100). test_b(N, _, _, 0) -> io:format(" ok~n"); test_b(N, F, I, J) -> {X, F1} = F(), io:format("X~w = ~w, ", [I,X]), test_b(N, F1, I+1, J-1). From ulf.wiger@REDACTED Wed Jun 9 11:50:57 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 9 Jun 2004 11:50:57 +0200 Subject: Storing/Accessing stuff in a big terrain map Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F5402787@ESEALNT442.al.sw.ericsson.se> Ooh, tricky. I guess you're talking about storing DTEDs (Digital Terrain Elevation Data) etc.? One of my largely unsuccessful prototypes was 'gridfile', which was based on an idea for a symmetric multi-key file structure (Nievergelt & Hinterberger, from Stonebraker's "Readings in Database Systems, 2nd ed." 1994). I never got it to work satisfactorily, but the big culprit was the notion that the key(s) could be any legal Erlang term - this made bucket splitting and merging in multiple dimensions somewhat difficult, where the article simply used integer ranges in a virtual grid. Using standard DTED formats (e.g. http://www.caf.dlr.de/SRTM/produkte/SRTM-XSAR-DEM-DTED-1.1.pdf), one could make a specialized gridfile that might scale a whole lot better than my version did. My attempts can be found at http://www.erlang.org/user.html, namely 'bucket_grid-1.0' and the older 'gridfile-1.0'. Both are only partially correct, and never did scale well. The most buggy part is previous/next (where I also bit off more than I could chew.) Perhaps the best option would be to start over... I guess when trying to use Erlang for this type of thing, you have to determine what level of scalability and performance is "good enough". /Uffe > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Marc > van Woerkom > Sent: den 9 juni 2004 11:07 > To: erlang-questions@REDACTED > Subject: Storing/Accessing stuff in a big terrain map > > > I would still like suggestions how to store stuff in a > large terrain map in a nice way in Erlang. > That is not that obvious, I take frome the mail below, > where some Haskell guy simply interfaced to C. > :) > > Regards, > Marc > > > > --- die weitergeleitete Nachricht folgt --- > From Marc.Vanwoerkom@REDACTED Wed Jun 9 12:07:25 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Wed, 09 Jun 2004 12:07:25 +0200 Subject: Storing/Accessing stuff in a big terrain map In-Reply-To: <37FB7AA6F5F9814FB634A7BF4C35A6F5402787@ESEALNT442.al.sw.ericsson.se> Message-ID: Am Wed, 9 Jun 2004 11:50:57 +0200 hat "Ulf Wiger (AL/EAB)" geschrieben: > >Ooh, tricky. I guess you're talking about storing DTEDs >(Digital Terrain Elevation Data) etc.? Nah, much simpler. Just a plain game board (1000x1000 cells or such) and put/get some 16bits of information in every cell, to implement that ant simulation. Or a robot war or a car simulator.. :) Like Value = get(Map, X, Y, Bit) store(Map, X, Y, Bit, true) There is no array type in Erlang suitable for random access ops? >I guess when trying to use Erlang for this type of thing, >you have to determine what level of scalability and >performance is "good enough". Perhaps on really has to implement some Bif or talk to some C written storage server. :) Regards, Marc From ulf.wiger@REDACTED Wed Jun 9 13:06:11 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Wed, 9 Jun 2004 13:06:11 +0200 Subject: Storing/Accessing stuff in a big terrain map Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F540278A@ESEALNT442.al.sw.ericsson.se> Well, then you can try ets - either set or ordered_set - or perhaps gb_trees or 'lines' (on sourceforge). /Uffe > -----Original Message----- > From: Marc van Woerkom [mailto:Marc.Vanwoerkom@REDACTED] > Sent: den 9 juni 2004 12:07 > To: Ulf Wiger (AL/EAB); erlang-questions@REDACTED > Subject: Re: Storing/Accessing stuff in a big terrain map > > > Am Wed, 9 Jun 2004 11:50:57 +0200 hat > "Ulf Wiger (AL/EAB)" geschrieben: > > > >Ooh, tricky. I guess you're talking about storing DTEDs > >(Digital Terrain Elevation Data) etc.? > > Nah, much simpler. > Just a plain game board (1000x1000 cells or such) and > put/get some 16bits of information in every cell, to > implement that ant simulation. Or a robot war or a car > simulator.. :) > > Like > > Value = get(Map, X, Y, Bit) > > store(Map, X, Y, Bit, true) > > > > There is no array type in Erlang suitable for random > access ops? > > >I guess when trying to use Erlang for this type of thing, > >you have to determine what level of scalability and > >performance is "good enough". > > Perhaps on really has to implement some Bif or talk to > some C written storage server. :) > > Regards, > Marc > From davidw@REDACTED Wed Jun 9 16:12:07 2004 From: davidw@REDACTED (David N. Welton) Date: Wed, 09 Jun 2004 16:12:07 +0200 Subject: string:join ? Message-ID: <40C71AB7.9020509@eidetix.com> Hi, I was looking through the docs and didn't notice a string:join function. It would be, IMHO, a useful little utility. I've written my own, but I think it's a common enough operation that "leaving it as an excersize for the reader" might not be optimal. Thankyou, -- David N. Welton davidw@REDACTED From john@REDACTED Thu Jun 10 09:49:49 2004 From: john@REDACTED (John Landahl) Date: Thu, 10 Jun 2004 00:49:49 -0700 Subject: py_interface In-Reply-To: <41256EAD.005FC7FE.00@esocmail2.esoc.esa.int> References: <41256EAD.005FC7FE.00@esocmail2.esoc.esa.int> Message-ID: <200406100049.49506.john@landahl.org> On Tuesday 08 June 2004 09:11 am, Nigel.Head@REDACTED wrote: ... > PS: I've got to say that py_interface is seriously cool bananas! > > Once it works sweetly the next step is to use it to have erlang talk to > wxWindows/wxWidgets, via wxPython. I looked at the source for py_interface a little while ago and noticed it has its own mainloop/generator, much like the Twisted framework. Has anyone thought of doing a py_interface version which works within Twisted? Incidentally, Twisted already integrates pretty well with wxPython. _jpl_ From laura@REDACTED Thu Jun 10 09:58:13 2004 From: laura@REDACTED (Laura M. Castro Souto) Date: Thu, 10 Jun 2004 09:58:13 +0200 Subject: ODBC 2.0 drop in performance In-Reply-To: <20040609194205.GA12039@lfcia.org> References: <20040609194205.GA12039@lfcia.org> Message-ID: <40C81495.70105@alfa21.com> Hello all, Is there anyone using the new ODBC 2.0 version, released within R9C-1? We do, and we have detected a rather high drop in performance. We would like to know if this is a common/known problem or maybe is due to something related with us (we are using erlang odbc application to comunicate with postgresql on a linux i686 machine). Thank you very much in advance, Laura M. Castro From ingela@REDACTED Thu Jun 10 14:54:28 2004 From: ingela@REDACTED (Ingela Anderton) Date: Thu, 10 Jun 2004 14:54:28 +0200 Subject: ODBC 2.0 drop in performance References: <20040609194205.GA12039@lfcia.org> <40C81495.70105@alfa21.com> Message-ID: <16584.23044.936746.365370@gargle.gargle.HOWL> Laura M. Castro Souto wrote: > > Hello all, > > Is there anyone using the new ODBC 2.0 version, released within > R9C-1? We do, and we have detected a rather high drop in performance. We > would like to know if this is a common/known problem or maybe is due to > something related with us (we are using erlang odbc application to > comunicate with postgresql on a linux i686 machine). The big difference between odbc 2.0 and the previous version 1.0.8 (except new functionality) is that the internal communication mechanism was changed. This is mainly to make it more stable and easier to maintain. The old mechanism was forcing us to use more and more complicated and strange workarounds when some sql-drivers messes with file-descriptors thus disturbing the erlang-port-communication. Now the erlang-port-mechanism is only used very limited and most communication is done via sockets. We did not expect this change to cause any noticeable changes in performance and I can't say that we have noticed anything like that in our testing, on the other hand we have not made any special performance tests. How much is a "rather high" performance drop? You could always try to run it in a very clean environment to try to eliminate other factors such as high network load etc.. -- /Ingela From laura@REDACTED Thu Jun 10 16:47:20 2004 From: laura@REDACTED (Laura M. Castro Souto) Date: Thu, 10 Jun 2004 16:47:20 +0200 Subject: ODBC 2.0 drop in performance In-Reply-To: <16584.23044.936746.365370@gargle.gargle.HOWL> References: <20040609194205.GA12039@lfcia.org> <40C81495.70105@alfa21.com> <16584.23044.936746.365370@gargle.gargle.HOWL> Message-ID: <40C87478.10007@alfa21.com> Ingela Anderton wrote: > > How much is a "rather high" performance drop? You could always try to > run it in a very clean environment to try to eliminate other factors > such as high network load etc.. > In fact, we have tested exactly the same configuration of our application with both Erlang-R9C-0 and Erlang-R9C-1. To be able to have a measure of this performance drop we have massively populated our database in these environments and the difference is about 5 times. Besides, this behaviour shows not only on write but on read queries as well. The network load is not critical, because we obtain the same results if we have server, database and client running on the same machine. Of course we could go back to Erlang-R9C-0, but we are aware of the memory management problems on ODBC 1.8, since we have dealed with the C code and fixed some minnor bugs. These seem to have been removed with the new implementation, so it would be better for us to use the new and corrected ODBC release. By the way, we guessed we have found some little mistakes in the C source code driver Makefile (dissabled optimizations, debugging options enabled, etc), but they are not the reason for the performance drop. Any help would be very welcome :-). Thank you! Laura M. Castro From laura@REDACTED Thu Jun 10 16:51:23 2004 From: laura@REDACTED (Laura M. Castro Souto) Date: Thu, 10 Jun 2004 16:51:23 +0200 Subject: ODBC 2.0 drop in performance In-Reply-To: <16584.23044.936746.365370@gargle.gargle.HOWL> References: <20040609194205.GA12039@lfcia.org> <40C81495.70105@alfa21.com> <16584.23044.936746.365370@gargle.gargle.HOWL> Message-ID: <40C8756B.8030500@alfa21.com> Ingela Anderton wrote: > > How much is a "rather high" performance drop? You could always try to > run it in a very clean environment to try to eliminate other factors > such as high network load etc.. > In fact, we have tested exactly the same configuration of our application with both Erlang-R9C-0 and Erlang-R9C-1. To be able to have a measure of this performance drop we have massively populated our database in these environments and the difference is about 5 times. Besides, this behaviour shows not only on write but on read queries as well. The network load is not critical, because we obtain the same results if we have server, database and client running on the same machine. Of course we could go back to Erlang-R9C-0, but we are aware of the memory management problems on ODBC 1.8, since we have dealed with the C code and fixed some minnor bugs. These seem to have been removed with the new implementation, so it would be better for us to use the new and corrected ODBC release. By the way, we guessed we have found some little mistakes in the C source code driver Makefile (dissabled optimizations, debugging options enabled, etc), but they are not the reason for the performance drop. Any help would be very welcome :-). Thank you! Laura M. Castro From mlogan@REDACTED Thu Jun 10 18:57:12 2004 From: mlogan@REDACTED (Martin J. Logan) Date: 10 Jun 2004 11:57:12 -0500 Subject: ErlCee++ In-Reply-To: <200406090534.i595Yr4f329053@atlas.otago.ac.nz> References: <200406090534.i595Yr4f329053@atlas.otago.ac.nz> Message-ID: <1086886631.2139.4608.camel@dhcp-lom-194-186.futuresource.com> That sounds really great - is it a for pay product, part of his private collection, or is there a way to get at it? Martin On Wed, 2004-06-09 at 00:34, Richard A. O'Keefe wrote: > Luke Gorrie wrote: > I'd really like to see an Erlang-like runtime system built on Unix > processes. How far towards the Erlang programming style could it be > pushed? Wouldn't it be fun to be able to write "Erlang" processes in > any language and mix 'em all together? > > Geoff Wong has implemented Erlang that way: Erlang process == UNIX process. > This is the GERL implementation. From tobbe@REDACTED Thu Jun 10 22:18:57 2004 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: Thu, 10 Jun 2004 22:18:57 +0200 Subject: ErlCee++ In-Reply-To: <1086886631.2139.4608.camel@dhcp-lom-194-186.futuresource.com> References: <200406090534.i595Yr4f329053@atlas.otago.ac.nz> <1086886631.2139.4608.camel@dhcp-lom-194-186.futuresource.com> Message-ID: <40C8C231.6040408@nortelnetworks.com> Hi, The work was part of is PhD I belive. Geoff can be reached at: geoff@REDACTED Cheers, Tobbe Martin J. Logan wrote: >That sounds really great - is it a for pay product, part of his private >collection, or is there a way to get at it? > >Martin > > >On Wed, 2004-06-09 at 00:34, Richard A. O'Keefe wrote: > > >>Luke Gorrie wrote: >> I'd really like to see an Erlang-like runtime system built on Unix >> processes. How far towards the Erlang programming style could it be >> pushed? Wouldn't it be fun to be able to write "Erlang" processes in >> any language and mix 'em all together? >> >>Geoff Wong has implemented Erlang that way: Erlang process == UNIX process. >>This is the GERL implementation. >> >> > > > From robert.virding@REDACTED Thu Jun 10 23:17:43 2004 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 10 Jun 2004 23:17:43 +0200 Subject: string:join ? References: <40C71AB7.9020509@eidetix.com> Message-ID: <014801c44f30$5e800810$8200a8c0@Rovir> What is string:join supposed to do? If it just a simple concatenation of two strings then S1 ++ S2 well defined and efficient. Robert ----- Original Message ----- From: "David N. Welton" To: Sent: Wednesday, June 09, 2004 4:12 PM Subject: string:join ? > Hi, > > I was looking through the docs and didn't notice a string:join function. > It would be, IMHO, a useful little utility. I've written my own, > but I think it's a common enough operation that "leaving it as an > excersize for the reader" might not be optimal. > > Thankyou, > -- > David N. Welton > davidw@REDACTED > From robert.virding@REDACTED Thu Jun 10 23:23:49 2004 From: robert.virding@REDACTED (Robert Virding) Date: Thu, 10 Jun 2004 23:23:49 +0200 Subject: can I select over functions? References: Message-ID: <015901c44f31$38e0b9a0$8200a8c0@Rovir> From: "Marc van Woerkom" > The pseudo code in the icfp contest task had some piece > like > > case instruction of > move(Ant, Steps) -> > .. > turn(LeftRight) -> > .. > sense(Direction, Time, Moonphase) -> > .. > end > > where the different cases are not simple values like a > token for the intended instruction, but functions. What are you actually trying to do here, compare Instruction with the actual functions (i.e. it is a function) or compare it with the values of the evaluated functions? The name(...) syntax means a function call. There is no real way of defining a function object except with fun's and comparing funs works but is limited. Robert From hedeland@REDACTED Fri Jun 11 00:43:54 2004 From: hedeland@REDACTED (Per Hedeland) Date: Fri, 11 Jun 2004 00:43:54 +0200 (CEST) Subject: string:join ? In-Reply-To: <014801c44f30$5e800810$8200a8c0@Rovir> Message-ID: <200406102243.i5AMhsGr080722@tordmule.bluetail.com> "Robert Virding" wrote: > >What is string:join supposed to do? If it just a simple concatenation of two >strings then S1 ++ S2 well defined and efficient. 'man perlfunc' (ducking:-) Or join(List, Sep) -> lists:foldl(fun(A, "") -> A; (A, Acc) -> Acc ++ Sep ++ A end, "", List). Or "The opposite of string:tokens/2" (sort of). Or at least that's what I assume... (And I agree that it's "missing".:-) --Per Hedeland >----- Original Message ----- >From: "David N. Welton" >To: >Sent: Wednesday, June 09, 2004 4:12 PM >Subject: string:join ? > > >> Hi, >> >> I was looking through the docs and didn't notice a string:join function. >> It would be, IMHO, a useful little utility. I've written my own, >> but I think it's a common enough operation that "leaving it as an >> excersize for the reader" might not be optimal. >> >> Thankyou, >> -- >> David N. Welton >> davidw@REDACTED >> > > From davidw@REDACTED Fri Jun 11 10:20:43 2004 From: davidw@REDACTED (David N. Welton) Date: Fri, 11 Jun 2004 10:20:43 +0200 Subject: string:join ? In-Reply-To: <200406102243.i5AMhsGr080722@tordmule.bluetail.com> References: <200406102243.i5AMhsGr080722@tordmule.bluetail.com> Message-ID: <40C96B5B.6040004@eidetix.com> Per Hedeland wrote: > "Robert Virding" wrote: > >>What is string:join supposed to do? If it just a simple concatenation of two >>strings then S1 ++ S2 well defined and efficient. > 'man perlfunc' (ducking:-) Joking aside, I've used scripting languages a lot in the past, and they all have some form of string join that, yes, more or less behaves like the one Perl provides: I have: ["Foo", "Bar", "Baz"] I want: "Foo Bar Baz" (I might also want to join them with something besides a blank space). > Or at least that's what I assume... Yes, it has been duly pointed out several times to me in private that I neglected to state clearly what I wanted:-) > (And I agree that it's "missing".:-) It's a handy feature to have when working with strings. Thanks, -- David N. Welton davidw@REDACTED From Marc.Vanwoerkom@REDACTED Fri Jun 11 10:19:26 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Fri, 11 Jun 2004 10:19:26 +0200 Subject: can I select over functions? In-Reply-To: <015901c44f31$38e0b9a0$8200a8c0@Rovir> Message-ID: Am Thu, 10 Jun 2004 23:23:49 +0200 hat "Robert Virding" geschrieben: >From: "Marc van Woerkom" > >> The pseudo code in the icfp contest task had some piece >> like >> >> case instruction of >> move(Ant, Steps) -> >> .. >> turn(LeftRight) -> >> .. >> sense(Direction, Time, Moonphase) -> >> .. >> end >> >> where the different cases are not simple values like a >> token for the intended instruction, but functions. > >What are you actually trying to do here, compare >Instruction with the actual >functions (i.e. it is a function) or compare it with the >values of the >evaluated functions? Intendend is comparison of functions, maybe case instruction of move/2 -> .. turn/1 -> .. sense/3 -> .. end would be closer to the Erlang spirit. > The name(...) syntax means a >function call. There is no >real way of defining a function object except with fun's >and comparing funs >works but is limited. May you tell me how that comparison of functions (or is 'fun' limited to anonymous functions) looks like? I did not spot it when I looked for it. Regards, Marc From valentin@REDACTED Fri Jun 11 12:10:24 2004 From: valentin@REDACTED (Valentin) Date: Fri, 11 Jun 2004 12:10:24 +0200 Subject: string:join ? References: <200406102243.i5AMhsGr080722@tordmule.bluetail.com> <40C96B5B.6040004@eidetix.com> Message-ID: <006501c44f9c$508e6be0$0100a8c0@MONEYMAKER2> So what is wrong with: lists:concat( ["Hello", " ", "World"] ). or if you insist: lists"concat( ["Foo", " ", "Bar", " ", "Bazz"]). Seriously, what am I missing here? V. ----- Original Message ----- From: "David N. Welton" To: Sent: Friday, June 11, 2004 10:20 AM Subject: Re: string:join ? > Per Hedeland wrote: > > "Robert Virding" wrote: > > > >>What is string:join supposed to do? If it just a simple concatenation of two > >>strings then S1 ++ S2 well defined and efficient. > > > 'man perlfunc' (ducking:-) > > Joking aside, I've used scripting languages a lot in the past, and they > all have some form of string join that, yes, more or less behaves like > the one Perl provides: > > I have: ["Foo", "Bar", "Baz"] > > I want: "Foo Bar Baz" > > (I might also want to join them with something besides a blank space). > > > Or at least that's what I assume... > > Yes, it has been duly pointed out several times to me in private that I > neglected to state clearly what I wanted:-) > > > (And I agree that it's "missing".:-) > > It's a handy feature to have when working with strings. > > Thanks, > -- > David N. Welton > davidw@REDACTED From davidw@REDACTED Fri Jun 11 12:20:38 2004 From: davidw@REDACTED (David N. Welton) Date: Fri, 11 Jun 2004 12:20:38 +0200 Subject: is_function vs tuples (functions in non-local modules) Message-ID: <40C98776.906@eidetix.com> Here's another one that's got me scratching my head: 1> c(parser). {ok,parser} 2> parser:tr("x"). "x" 3> Fun = {parser, tr}. {parser,tr} 4> Fun("x"). "x" 5> {parser, tr}("x"). "x" 6> is_function(Fun). false 7> is_function({parser, tr}). false Is there any way to tell? Reason being, I want to pass a list of things to a function. This function should only call the ones that are actually functions. I guess I could use catch, but that's got it's own problems (if it is a function and it errors out, I want the error to be passed on up) and doesn't seem elegant. Thankyou once again for your time, -- David N. Welton davidw@REDACTED From fredrik.linder@REDACTED Fri Jun 11 13:42:21 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Fri, 11 Jun 2004 13:42:21 +0200 Subject: is_function vs tuples (functions in non-local modules) Message-ID: You could use erlang:function_exported/3. /Fredrik > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of David N. Welton > Sent: den 11 juni 2004 12:21 > To: erlang-questions@REDACTED > Subject: is_function vs tuples (functions in non-local modules) > > > Here's another one that's got me scratching my head: > > 1> c(parser). > {ok,parser} > 2> parser:tr("x"). > "x" > 3> Fun = {parser, tr}. > {parser,tr} > 4> Fun("x"). > "x" > 5> {parser, tr}("x"). > "x" > 6> is_function(Fun). > false > 7> is_function({parser, tr}). > false > > Is there any way to tell? > > Reason being, I want to pass a list of things to a function. This > function should only call the ones that are actually > functions. I guess > I could use catch, but that's got it's own problems (if it is > a function > and it errors out, I want the error to be passed on up) and > doesn't seem > elegant. > > Thankyou once again for your time, > -- > David N. Welton > davidw@REDACTED > From hedeland@REDACTED Fri Jun 11 13:59:46 2004 From: hedeland@REDACTED (Per Hedeland) Date: Fri, 11 Jun 2004 13:59:46 +0200 (CEST) Subject: string:join ? In-Reply-To: <006501c44f9c$508e6be0$0100a8c0@MONEYMAKER2> Message-ID: <200406111159.i5BBxklc010164@tordmule.bluetail.com> "Valentin" wrote: > >So what is wrong with: > >lists:concat( ["Hello", " ", "World"] ). > >or if you insist: > >lists"concat( ["Foo", " ", "Bar", " ", "Bazz"]). > >Seriously, what am I missing here? Primarily that the length of the list of strings isn't necessarily known in advance. Plus it's more typing even if you know.:-) --Per From mats.cronqvist@REDACTED Fri Jun 11 14:02:54 2004 From: mats.cronqvist@REDACTED (mats cronqvist) Date: Fri, 11 Jun 2004 14:02:54 +0200 Subject: is_function vs tuples (functions in non-local modules) In-Reply-To: <40C98776.906@eidetix.com> References: <40C98776.906@eidetix.com> Message-ID: > Parser_tr = fun(X)->parser:tr(X) end. #Fun > is_function(Parser_tr). true in your example Fun is a tuple. > Here's another one that's got me scratching my head: > > 1> c(parser). > {ok,parser} > 2> parser:tr("x"). > "x" > 3> Fun = {parser, tr}. > {parser,tr} > 4> Fun("x"). > "x" > 5> {parser, tr}("x"). > "x" > 6> is_function(Fun). > false > 7> is_function({parser, tr}). > false > > Is there any way to tell? > > Reason being, I want to pass a list of things to a function. This > function should only call the ones that are actually functions. I guess > I could use catch, but that's got it's own problems (if it is a function > and it errors out, I want the error to be passed on up) and doesn't seem > elegant. > > Thankyou once again for your time, From sean.hinde@REDACTED Fri Jun 11 14:24:29 2004 From: sean.hinde@REDACTED (Sean Hinde) Date: Fri, 11 Jun 2004 13:24:29 +0100 Subject: is_function vs tuples (functions in non-local modules) In-Reply-To: References: <40C98776.906@eidetix.com> Message-ID: <490A963B-BBA2-11D8-A85D-000A95927CCE@mac.com> The Fun as tuple syntax is one of the wilder old bits of cruft in Erlang. I would just document that it isn't supported by your parser. I would guess that no-one uses it in new code except to make that point that they can.. Sean On 11 Jun 2004, at 13:02, mats cronqvist wrote: >> Parser_tr = fun(X)->parser:tr(X) end. > #Fun >> is_function(Parser_tr). > true > > in your example Fun is a tuple. > >> Here's another one that's got me scratching my head: >> >> 1> c(parser). >> {ok,parser} >> 2> parser:tr("x"). >> "x" >> 3> Fun = {parser, tr}. >> {parser,tr} >> 4> Fun("x"). >> "x" >> 5> {parser, tr}("x"). >> "x" >> 6> is_function(Fun). >> false >> 7> is_function({parser, tr}). >> false >> >> Is there any way to tell? >> >> Reason being, I want to pass a list of things to a function. This >> function should only call the ones that are actually functions. I >> guess I could use catch, but that's got it's own problems (if it is a >> function and it errors out, I want the error to be passed on up) and >> doesn't seem elegant. >> >> Thankyou once again for your time, > > From carsten@REDACTED Fri Jun 11 17:16:47 2004 From: carsten@REDACTED (Carsten Schultz) Date: Fri, 11 Jun 2004 17:16:47 +0200 Subject: is_function vs tuples (functions in non-local modules) In-Reply-To: <490A963B-BBA2-11D8-A85D-000A95927CCE@mac.com> References: <40C98776.906@eidetix.com> <490A963B-BBA2-11D8-A85D-000A95927CCE@mac.com> Message-ID: <20040611151647.GA9056@penne.localnet> Hi Sean! On Fri, Jun 11, 2004 at 01:24:29PM +0100, Sean Hinde wrote: > The Fun as tuple syntax is one of the wilder old bits of cruft in > Erlang. I would just document that it isn't supported by your parser. > > I would guess that no-one uses it in new code except to make that point > that they can.. I would not be too sure about that. As long as there is no nice syntactic short cut for fun (X,Y,Z) -> foo:bar(X,Y,Z) end (`fun foo:bar/3' would come to mind) I find it plausible that someone writes {foo,bar} for that. This is of course just a pledge for that kind of syntax. I do find the tuple version irritating, too. Even then the tuple version will work for a variable number of arguments, while the fun version will not. Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From ok@REDACTED Mon Jun 14 06:52:53 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 14 Jun 2004 16:52:53 +1200 (NZST) Subject: ErlCee++ Message-ID: <200406140452.i5E4qr71404066@atlas.otago.ac.nz> I mentioned Geoff Wong's "GERL" implementation. "Martin J. Logan" replied: That sounds really great - is it a for pay product, part of his private collection, or is there a way to get at it? The work was done in the Software Engineering Reserch Centre at RMIT in Melbourne as part of Geoff's PhD work. It was reported in a paper "Compiling Erlang via C". The main aim of the system was to support some special monitoring tools. I have a copy of the system which I got over the net somehow, but I no longer recall the URL. I do not know whether any work was done on it after 1998, so there are some new features of Erlang that aren't supported. From ok@REDACTED Mon Jun 14 06:24:21 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Mon, 14 Jun 2004 16:24:21 +1200 (NZST) Subject: string:join ? Message-ID: <200406140424.i5E4OL87415063@atlas.otago.ac.nz> Per Hedeland wrote: 'man perlfunc' (ducking:-) Erlang being a mostly-functional language, perhaps it would be more appropriate to cite the Haskell version (and it would CERTAINLY be clearer to use the Haskell name, because there are lots and lots and LOTS of ways to 'join' strings): unwords :: [String] -> String unwords [] = [] unwords ws = foldr1 (\w s -> w ++ ' ':s) ws join(List, Sep) -> lists:foldl(fun(A, "") -> A; (A, Acc) -> Acc ++ Sep ++ A end, "", List). This is actually a perfect definition of why it would be good to have it in the library. Done right, it's O(size of result), done wrong, it's very costly indeed, and this one is done wrong. unwords(Words) -> unwords(Words, " "). unwords([Word|Words], []) -> unwords_0(Words, Word); unwords([Word|Words], [Sep]) -> unwords_1(Words, Word, Sep); unwords([Word|Words], Sep) -> unwords_m(Words, Word, Sep); unwords([], _) -> []. % Special case for Sep = [] unwords_0([Word2|Words], Word1) -> Word1 ++ unwords_0(Words, Word2); unwords_0([], Word1) -> Word1. % Special case for Sep = [_] unwords_1([Word2|Words], Word1, Sep) -> Word1 ++ [Sep | unwords_1(Words, Word2, Sep)]; unwords_1([], Word1, _) -> Word1. % General case for multi-element Sep. unwords_m([Word2|Words], Word1, Sep) -> Word1 ++ (Sep ++ unwords_m(Words, Word2, Sep)); unwords_m([], Word1, _) -> Word1. From davidw@REDACTED Mon Jun 14 12:42:50 2004 From: davidw@REDACTED (David N. Welton) Date: Mon, 14 Jun 2004 12:42:50 +0200 Subject: is_function vs tuples (functions in non-local modules) In-Reply-To: <20040611151647.GA9056@penne.localnet> References: <40C98776.906@eidetix.com> <490A963B-BBA2-11D8-A85D-000A95927CCE@mac.com> <20040611151647.GA9056@penne.localnet> Message-ID: <40CD812A.5010503@eidetix.com> Carsten Schultz wrote: >>I would guess that no-one uses it in new code except to make that point >>that they can.. > I would not be too sure about that. As long as there is no nice > syntactic short cut for > > fun (X,Y,Z) -> foo:bar(X,Y,Z) end > > (`fun foo:bar/3' would come to mind) I find it plausible that someone > writes {foo,bar} for that. Yes, that's the problem I encountered. It surprised me that foo/3 worked, but mod:foo/3 didn't. Thankyou, -- David N. Welton davidw@REDACTED From ulf.wiger@REDACTED Mon Jun 14 12:45:09 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Mon, 14 Jun 2004 12:45:09 +0200 Subject: hibernate and proc_lib Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F540279B@ESEALNT442.al.sw.ericsson.se> There is a function called erlang:hibernate/3, which reduces the memory footprint of a process as much as possible until it receives a message. This function can be useful for applications that require a very large number of processes, but run into problems with memory consumption. Each time a process can be expected to idle for a while, one can call erlang:hibernate(Mod,Function,Args), and the process will be shrunk until it has reason to wake up, in which case apply(Mod,Function,Args) is called, and execution continues from there. One of the things hibernate/3 does is remove the stack, which also means that any 'catch' will also be removed. This is not a big problem, as long as you're aware of it. For example, if one has a top-level catch for central error handling, this catch has to be re-inserted each time after hibernation. This is reasonably easy to do if a wrapper function is provided. As an example, consider proc_lib:spawn_link(M,F,A). It is used e.g. by gen_servers and supervisors, and makes it possible to receive crash reports if the process dies. This is accomplished using a top-level catch in proc_lib: init_p(Parent,Ancestors,M,F,A) -> put('$ancestors',[Parent|Ancestors]), put('$initial_call',{M,F,A}), Result = (catch apply(M,F,A)), exit_p(Result,{M,F,A}). exit_p({'EXIT',Reason},StartF) -> crash_report(Reason,StartF), exit(Reason); exit_p(Reason,_) -> Reason. Doing hibernate on such a process would have the effect that no crash report would be generated after a crash, unless one provides a proc_lib:hibernate(M,F,A): hibernate(M,F,A) -> erlang:hibernate(proc_lib, wake_up, [M,F,A]). wake_up(M,F,A) -> Result = (catch apply(M,F,A)), exit_p(Result, {M,F,A}). I propose that OTP add such a function to proc_lib.erl in order to highlight the issue and demonstrate the workaround. /Uffe From d.love@REDACTED Mon Jun 14 18:00:31 2004 From: d.love@REDACTED (Dave Love) Date: Mon, 14 Jun 2004 17:00:31 +0100 Subject: ErlCee++ In-Reply-To: <1086886631.2139.4608.camel@dhcp-lom-194-186.futuresource.com> (Martin J. Logan's message of "10 Jun 2004 11:57:12 -0500") References: <200406090534.i595Yr4f329053@atlas.otago.ac.nz> <1086886631.2139.4608.camel@dhcp-lom-194-186.futuresource.com> Message-ID: "Martin J. Logan" writes: > That sounds really great - is it a for pay product, part of his private > collection, or is there a way to get at it? Go via the www.erlang.org `Links' page. From olgeni@REDACTED Sun Jun 13 21:00:37 2004 From: olgeni@REDACTED (Jimmy Olgeni) Date: Sun, 13 Jun 2004 21:00:37 +0200 (CEST) Subject: BUG report: py_interface-0.9 In-Reply-To: <41256EAD.005FC7FE.00@esocmail2.esoc.esa.int> References: <41256EAD.005FC7FE.00@esocmail2.esoc.esa.int> Message-ID: <20040613205937.T4417@olgeni.olgeni> On Tue, 8 Jun 2004 Nigel.Head@REDACTED wrote: > Attached a short change to py_interface-0.9 (erl_term.py) ..., seems also to be > applicable to 0.91. More fixes here :) (version 1.3) http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/py_otp_interface/files/patch-erl__term.py -- jimmy From bjorn@REDACTED Tue Jun 15 11:19:54 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 15 Jun 2004 11:19:54 +0200 Subject: hibernate and proc_lib In-Reply-To: <37FB7AA6F5F9814FB634A7BF4C35A6F540279B@ESEALNT442.al.sw.ericsson.se> References: <37FB7AA6F5F9814FB634A7BF4C35A6F540279B@ESEALNT442.al.sw.ericsson.se> Message-ID: We have added the suggested hibernate/3 to proc_lib. It will be released as a patch and also in R9C-2. /Bjorn "Ulf Wiger (AL/EAB)" writes: > There is a function called erlang:hibernate/3, which reduces the memory > footprint of a process as much as possible until it receives a message. > This function can be useful for applications that require a very large > number of processes, but run into problems with memory consumption. > Each time a process can be expected to idle for a while, one can call > erlang:hibernate(Mod,Function,Args), and the process will be shrunk > until it has reason to wake up, in which case apply(Mod,Function,Args) > is called, and execution continues from there. > > One of the things hibernate/3 does is remove the stack, which also > means that any 'catch' will also be removed. This is not a big problem, > as long as you're aware of it. > > For example, if one has a top-level catch for central error handling, > this catch has to be re-inserted each time after hibernation. This > is reasonably easy to do if a wrapper function is provided. > > As an example, consider proc_lib:spawn_link(M,F,A). > It is used e.g. by gen_servers and supervisors, and makes it possible to > receive crash reports if the process dies. This is accomplished using a > top-level catch in proc_lib: > > init_p(Parent,Ancestors,M,F,A) -> > put('$ancestors',[Parent|Ancestors]), > put('$initial_call',{M,F,A}), > Result = (catch apply(M,F,A)), > exit_p(Result,{M,F,A}). > > exit_p({'EXIT',Reason},StartF) -> > crash_report(Reason,StartF), > exit(Reason); > exit_p(Reason,_) -> > Reason. > > Doing hibernate on such a process would have the effect that > no crash report would be generated after a crash, unless one > provides a proc_lib:hibernate(M,F,A): > > hibernate(M,F,A) -> > erlang:hibernate(proc_lib, wake_up, [M,F,A]). > > wake_up(M,F,A) -> > Result = (catch apply(M,F,A)), > exit_p(Result, {M,F,A}). > > I propose that OTP add such a function to proc_lib.erl in order > to highlight the issue and demonstrate the workaround. > > /Uffe > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From ulf.wiger@REDACTED Tue Jun 15 11:36:56 2004 From: ulf.wiger@REDACTED (Ulf Wiger (AL/EAB)) Date: Tue, 15 Jun 2004 11:36:56 +0200 Subject: online web stats Message-ID: <37FB7AA6F5F9814FB634A7BF4C35A6F54027AB@ESEALNT442.al.sw.ericsson.se> I checked out the online demo of the SourceForge Project of the Month: http://awstats.sourceforge.net/cgi-bin/awstats.pl It seems like this would be reasonably easy to implement for INETS and YAWS. (I'm not going to do it, but though somebody else might... ;-) The way to achieve the bar graphs was cute: Number of visits: 1943 Pages: 2735 Hits: 2735 Bandwidth: 89.69 MB ...usw /Uffe From erlang@REDACTED Tue Jun 15 13:39:00 2004 From: erlang@REDACTED (Peter-Henry Mander) Date: Tue, 15 Jun 2004 12:39:00 +0100 Subject: hibernate and proc_lib In-Reply-To: References: <37FB7AA6F5F9814FB634A7BF4C35A6F540279B@ESEALNT442.al.sw.ericsson.se> Message-ID: <20040615123900.5be7517d.erlang@manderp.freeserve.co.uk> Hi, Is there a version that uses funs too? e.g. erlang:hibernate/1 Pete. On 15 Jun 2004 11:19:54 +0200 Bjorn Gustavsson wrote: > We have added the suggested hibernate/3 to proc_lib. It will be > released as a patch and also in R9C-2. > > /Bjorn -- "The Tao of Programming flows far away and returns on the wind of morning." From bry@REDACTED Tue Jun 15 15:49:15 2004 From: bry@REDACTED (bry@REDACTED) Date: Tue, 15 Jun 2004 15:49:15 +0200 Subject: OT: code evaluation as nodes on a graph Message-ID: <1087307355.40cefe5bd0b49@horde.scannet.dk> This is off-topic but I thought someone might have some ideas here, if not here point me to a good place for reading: I have a little project I did a while back of a multiple language evaluation environment, handled javascript, vbscript, python in the same environment, so that I could declare a variable in python to take the value of a variable in javascript, okay so far not very interesting, but last night I realized a way that I could take evaluation of programs written in the language and change the order by layering them on top of different evaluation models (this is relatively easy to do because of the way I have set things up), the idea I had especially was layering them on top of graphs of how the program should evaluate; so for example: node n0: jscript code here node n1: jscript code here node n2: python code edge e0: from n0 to n2 edge e1: from n1 to n2 So that n0 code would be evaluated then the edge e0 would go to n2, the problem of course is that I don't have my own controllable scripting implementations, I am instead relying on various ActiveScripting implementations. in the example above n1 to n2 wouldn't be evaluated, if we assume that n0 is the entry point for the graph. But in with these edges: edge e0: from n0 to n2 edge e1: from n0 to n1 n0 could be evaluated, then n2 (which makes use of some of the variables etc. set by n0) and then n1, since these languages are not functional ones the chance of side effects increases. okay, I suppose this might sound somewhat stupid, but if anyone has any ideas I'd be interested. Also if you can think of other models of evaluation that could be interesting. From mickael.remond@REDACTED Wed Jun 16 00:55:18 2004 From: mickael.remond@REDACTED (=?iso-8859-15?Q?Micka=EBl_R=E9mond?=) Date: Tue, 15 Jun 2004 22:55:18 -0000 Subject: online web stats In-Reply-To: <37FB7AA6F5F9814FB634A7BF4C35A6F54027AB@ESEALNT442.al.sw.ericsson.se> References: <37FB7AA6F5F9814FB634A7BF4C35A6F54027AB@ESEALNT442.al.sw.ericsson.se> Message-ID: On Tue, 15 Jun 2004 11:36:56 +0200, Ulf Wiger (AL/EAB) wrote: > > I checked out the online demo of the SourceForge Project of the Month: > > http://awstats.sourceforge.net/cgi-bin/awstats.pl > > It seems like this would be reasonably easy to implement for INETS and > YAWS. > > (I'm not going to do it, but though somebody else might... ;-) Maybe it is time to announce the alpha version of Metafrog. This is a project management platform in Erlang. It is not yet feature complete and still has bug, but can give you a rough idea of what Metafrog can be soon. You can reach it at http://metafrog.erlang-projects.org/ Please, to not hesitate to send me feedbacks and suggestions -- Micka?l R?mond http://www.erlang-projects.org/ From jeinhorn@REDACTED Thu Jun 17 00:24:53 2004 From: jeinhorn@REDACTED (Jeffrey M. Einhorn) Date: Wed, 16 Jun 2004 17:24:53 -0500 Subject: Fedora 2 and tv:start(). Message-ID: <1087424693.2414.349.camel@dhcp-lom-194-199.futuresource.com> I have found that tv does not work on Fedora 2. Has anyone else experienced this problem and had any luck getting this to work? Thanks for your time, Jeff -- Jeffrey M. Einhorn Systems Manager FutureSource 630.792.2065 jeinhorn@REDACTED From fredrik.linder@REDACTED Thu Jun 17 17:53:22 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Thu, 17 Jun 2004 17:53:22 +0200 Subject: start_link and death of parent Message-ID: Hello OTP Folks I get this very strange behaviour from otp-r9c-0 built on redhat-8 or redhat-9 (not 100% sure which). Is this a known problem in r9c-0, and if so is it corrected in r9c-1? (traffic@REDACTED)265> whereis(d). undefined (traffic@REDACTED)266> l(d). {module,d} (traffic@REDACTED)267> P=spawn(fun()->io:format("result: ~w~n", [catch d:start_link()]) end). <1308.2281.0> result: {ok,<1308.2282.0>} (traffic@REDACTED)268> erlang:is_process_alive(P). false (traffic@REDACTED)269> whereis(d). <1308.2282.0> (traffic@REDACTED)270> erlang:is_process_alive(whereis(d)). true (traffic@REDACTED)271> exit(whereis(d),kill). true (traffic@REDACTED)272> whereis(d). undefined (traffic@REDACTED)273> Shouldn't <1308.2282.0> die when <1308.2281.0> dies. The 'd' module is just the emacs skeleton for gen_server in of r9c-0 with -define(SERVER, ?MODULE). /Fredrik -------------- next part -------------- A non-text attachment was scrubbed... Name: d.erl Type: application/octet-stream Size: 4689 bytes Desc: d.erl URL: From matthias@REDACTED Thu Jun 17 21:34:05 2004 From: matthias@REDACTED (Matthias Lang) Date: Thu, 17 Jun 2004 21:34:05 +0200 Subject: start_link and death of parent In-Reply-To: References: Message-ID: <16593.61997.518964.751440@antilipe.corelatus.se> Fredrik Linder writes: > Is this a known problem in r9c-0, and if so is it corrected in r9c-1? > Shouldn't <1308.2282.0> die when <1308.2281.0> dies. No, it should not die. By default, a linked process only exits if it receive an abnormal EXIT signal. Your 'fun' is exiting normally, thus the linked gen_server does not and should not exit. Or have I completely misunderstood your problem? (BTW: there's a very nice, concise Erlang reference up at http://www.erlang.org/doc/r9c/pdf/reference_manual-5.3.pdf Great work, whoever wrote it.) Matthias From fredrik.linder@REDACTED Fri Jun 18 09:28:14 2004 From: fredrik.linder@REDACTED (Fredrik Linder) Date: Fri, 18 Jun 2004 09:28:14 +0200 Subject: start_link and death of parent Message-ID: Ahh, {'EXIT', Pid, 'normal'} never kills a process... So, please ignore the previous message. /Fredrik > -----Original Message----- > From: owner-erlang-questions@REDACTED > [mailto:owner-erlang-questions@REDACTED]On Behalf Of Fredrik Linder > Sent: den 17 juni 2004 17:53 > To: erlang-questions@REDACTED > Subject: start_link and death of parent > > > Hello OTP Folks > > I get this very strange behaviour from otp-r9c-0 built on > redhat-8 or redhat-9 (not 100% sure which). > > Is this a known problem in r9c-0, and if so is it corrected in r9c-1? > > (traffic@REDACTED)265> whereis(d). > undefined > (traffic@REDACTED)266> l(d). > {module,d} > (traffic@REDACTED)267> P=spawn(fun()->io:format("result: > ~w~n", [catch d:start_link()]) end). > <1308.2281.0> > result: {ok,<1308.2282.0>} > (traffic@REDACTED)268> erlang:is_process_alive(P). > false > (traffic@REDACTED)269> whereis(d). > <1308.2282.0> > (traffic@REDACTED)270> erlang:is_process_alive(whereis(d)). > true > (traffic@REDACTED)271> exit(whereis(d),kill). > true > (traffic@REDACTED)272> whereis(d). > undefined > (traffic@REDACTED)273> > > Shouldn't <1308.2282.0> die when <1308.2281.0> dies. > > The 'd' module is just the emacs skeleton for gen_server in > of r9c-0 with -define(SERVER, ?MODULE). > > /Fredrik > From enewhuis@REDACTED Fri Jun 18 15:58:29 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Fri, 18 Jun 2004 08:58:29 -0500 Subject: Where is Erlang? Message-ID: <94176898-C12F-11D8-AAA5-000A95D9A520@futuresource.com> http://www.oreilly.com/pub/a/oreilly/news/languageposter_0504.html From Marc.Vanwoerkom@REDACTED Fri Jun 18 17:13:53 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Fri, 18 Jun 2004 17:13:53 +0200 Subject: Where is Erlang? In-Reply-To: <94176898-C12F-11D8-AAA5-000A95D9A520@futuresource.com> Message-ID: Am Fri, 18 Jun 2004 08:58:29 -0500 hat Eric Newhuis geschrieben: >http://www.oreilly.com/pub/a/oreilly/news/languageposter_0504.html What should be? Something rooted in Prolog? And some PHP guy here was unhappy about PHP being traced to Perl on that poster. :) Regards, Marc From mike@REDACTED Mon Jun 21 09:39:45 2004 From: mike@REDACTED (Mike Williams) Date: 21 Jun 2004 07:39:45 GMT Subject: FP as far away as ever from the mainstream...... Message-ID: See the article below about ICFP 2004. It seems that Functional Programming is as far away as ever from mainstream usage. In fact it still seems that Erlang is the only functional language which is making *any* headway in industrial / commercial applications. And the FP purists don't like us because Erlang isn't strongly typed and totally "pure". In retrospect we made a great mistake in promoting Erlang as an FP. Joe's idea of "concurrency oriented" languages would have made better sense..... /mike ------ Forwarded Article ------ From Kathleen Fisher I am pleased to announce that the following papers have been accepted for ICFP 2004 (http://www.cs.indiana.edu/icfp04/). In addition, Paul Graham, John Launchbury, and Ulf Wiger have graciously agreed to give invited talks. The final program will be available from the web site mid-July. Kathleen Fisher *********************************************************** Slideshow: Functional Presentations Robert Bruce Findler and Matthew Flatt Functional Morphology Markus Forsberg and Aarne Ranta Types for Path Correctness for XML Queries Dario Colazzo, Giorgio Ghelli, Paolo Mangh, and Carlo Sartiani Regular Expression Patterns Niklas Broberg, Andreas Farre, and Josef Svenningsson, Multi-return function call Olin Shivers and David Fisher Implementing Functional Logic Languages Using Multiple Threads and Stores Andrew Tolmach, Sergio Antoy, and Marius Nita Generics for the masses Ralf Hinze Scrap more boilerplate: reflection, zips, and generalised casts Ralf Laemmel and Simon Peyton Jones Making a fast curry: Push/enter vs eval/apply for higher-order languages Simon Marlow and Simon Peyton Jones Improving Static Analysis via Partial Evaluation for Embedded Languages David Herman and Philippe Meunier Searching for Deadlocks while Debugging Concurrent Haskell Programs Jan Christiansen and Frank Huch A Nanopass Infrastructure for Compiler Education Dipanwita Sarkar, Oscar Waddell, and R. Kent Dybvig Monadic Regions Matthew Fluet and Greg Morrisett Translating Dependency into Parametricity Stephen Tse and Steve Zdancewic A Type-Theoretic Foundation of Continuations and Prompts Zena Ariola, Hugo Herbelin, and Amr Sabry, Relating Models of Backtracking Mitchell Wand and Dale Vaillancourt Types, potency, and impotency: Why nonlinearity and amnesia make a type system work Peter M?ller Neergaard and Harry Mairson Numbering Matters: First Order Canonical Forms for Second-Order Recursive Types Nadji Gauthier and Fran?ois Pottier Process Logic and Duality Kohei Honda Verification of Safety Properties for Concurrent Assembly Code Dachuan Yu and Zhong Shao A Sound (and Complete) Model for Contracts Matthias Blume and David McAllester ------------------------------------------------------------ ------ End of Forwarded Article From peter@REDACTED Mon Jun 21 13:39:38 2004 From: peter@REDACTED (Peter Lund) Date: Mon, 21 Jun 2004 13:39:38 +0200 (CEST) Subject: keepalive timer? Message-ID: <9353.193.15.249.14.1087817978.squirrel@www69.webcows.se> Reading the documentation for module inet: {keepalive, Boolean} (TCP/IP sockets) Enables periodic transmission on a connected socket, when no other data is being exchanged. If the other end does not respond, the connection is considered broken and an error message will be sent to the controlling process. Default disabled. My question is: How long is this period by default between checks that the TCP connection still is alive? Is there a way to modify the default? (I saw some traces after some other undocumented option 'send_timeout', but I do not know if that was relevant to this problem or not.) -- Peter Lund mobile: +46 70 543 9416 http://www.lundata.se From matthias@REDACTED Mon Jun 21 17:39:52 2004 From: matthias@REDACTED (Matthias Lang) Date: Mon, 21 Jun 2004 17:39:52 +0200 Subject: keepalive timer? In-Reply-To: <9353.193.15.249.14.1087817978.squirrel@www69.webcows.se> References: <9353.193.15.249.14.1087817978.squirrel@www69.webcows.se> Message-ID: <16599.328.773711.595139@antilipe.corelatus.se> Your question isn't really about Erlang, it's about sockets. Erlang's keepalive corresponds to the POSIX* option SO_KEEPALIVE. Under linux you can query and modify the time through the /proc interface. E.g. on my desktop: for i in /proc/sys/net/ipv4/tcp_keepalive_*; do echo $i; cat $i; done /proc/sys/net/ipv4/tcp_keepalive_intvl 75 /proc/sys/net/ipv4/tcp_keepalive_probes 9 /proc/sys/net/ipv4/tcp_keepalive_time 7200 The linux source documents this reasonably well, in Documentation/fs/proc.txt |tcp_keepalive_probes |-------------------- | | Number of keep alive probes TCP sends out, until it | decides that the connection is broken. | |tcp_keepalive_time |------------------ | | How often TCP sends out keep alive messages, when keep | alive is enabled. The default is 2 hours. Google will tell you what the third value does. It appears that you can't configure the keepalive time on a per-socket basis, at least not under linux 2.4.25. Maybe it's possible under other operating systems, probably not. I don't know enough about other OSs' TCP stacks to answer. The send_timeout option has been discussed on the mailing list before. It isn't really related to your question. It doesn't do exactly what it should, which is probably why it's undocumented. See also: http://www.erlang.org/ml-archive/erlang-questions/200402/msg00259.html http://www.erlang.org/ml-archive/erlang-questions/200302/msg00157.html http://www.erlang.org/ml-archive/erlang-questions/200209/msg00076.html http://www.erlang.org/ml-archive/erlang-questions/200211/msg00197.html Matthias Peter Lund writes: > Reading the documentation for module inet: > > {keepalive, Boolean} > (TCP/IP sockets) Enables periodic transmission on a connected > socket, when no other data is being exchanged. If the other > end does not respond, the connection is considered broken and > an error message will be sent to the controlling process. > Default disabled. > > My question is: How long is this period by default between checks > that the TCP connection still is alive? > > Is there a way to modify the default? (I saw some traces after some > other undocumented option 'send_timeout', but I do not know if that > was relevant to this problem or not.) > > -- > Peter Lund > mobile: +46 70 543 9416 > http://www.lundata.se From hedeland@REDACTED Mon Jun 21 18:29:33 2004 From: hedeland@REDACTED (Per Hedeland) Date: Mon, 21 Jun 2004 18:29:33 +0200 (CEST) Subject: keepalive timer? In-Reply-To: <16599.328.773711.595139@antilipe.corelatus.se> Message-ID: <200406211629.i5LGTXOr028331@tordmule.bluetail.com> Matthias Lang wrote: > >It appears that you can't configure the keepalive time on a per-socket >basis, at least not under linux 2.4.25. Actually you can - from live and working code on 2.4.20-ish: int one = 1, idle = 60, intvl = 5, cnt = 3; setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)); setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl)); setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt)); (Those particular values are *not* suitable for your generic TCP session though.) I think I found documentation of this on some random web page (typical for Linux:-), it certainly isn't in the man pages. But you have the source...:-) > Maybe it's possible under >other operating systems, probably not. I don't know enough about other >OSs' TCP stacks to answer. I'll add my two ?re to the "probably not" vote. --Per From enewhuis@REDACTED Mon Jun 21 18:49:31 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Mon, 21 Jun 2004 11:49:31 -0500 Subject: FP as far away as ever from the mainstream...... In-Reply-To: References: Message-ID: Erlang isn't the only one. The K language (and KSQL) is functional (not pure) and making inroads in many financial institutions that deal with very large time-series data sets in time-critical applications. www.kx.com K actually made the O'Reilly language poster. On Jun 21, 2004, at 7:39 AM, Mike Williams wrote: > See the article below about ICFP 2004. It seems that Functional > Programming > is as far away as ever from mainstream usage. In fact it still seems > that > Erlang is the only functional language which is making *any* headway > in industrial / commercial applications. And the FP purists don't like > us because Erlang isn't strongly typed and totally "pure". > > In retrospect we made a great mistake in promoting Erlang as an FP. > Joe's idea of "concurrency oriented" languages would have made better > sense..... > > /mike > > > ------ Forwarded Article > > ------ From Kathleen Fisher > > I am pleased to announce that the following papers have been accepted > for ICFP 2004 (http://www.cs.indiana.edu/icfp04/). In addition, Paul > Graham, John Launchbury, and Ulf Wiger have graciously agreed to give > invited talks. The final program will be available from the web site > mid-July. > > Kathleen Fisher > *********************************************************** > Slideshow: Functional Presentations > Robert Bruce Findler and Matthew Flatt > > Functional Morphology > Markus Forsberg and Aarne Ranta > > Types for Path Correctness for XML Queries > Dario Colazzo, Giorgio Ghelli, Paolo Mangh, and Carlo Sartiani > > Regular Expression Patterns > Niklas Broberg, Andreas Farre, and Josef Svenningsson, > > Multi-return function call > Olin Shivers and David Fisher > > Implementing Functional Logic Languages Using Multiple Threads and > Stores > Andrew Tolmach, Sergio Antoy, and Marius Nita > > Generics for the masses > Ralf Hinze > > Scrap more boilerplate: reflection, zips, and generalised casts > Ralf Laemmel and Simon Peyton Jones > > Making a fast curry: Push/enter vs eval/apply for higher-order > languages > Simon Marlow and Simon Peyton Jones > > Improving Static Analysis via Partial Evaluation for Embedded Languages > David Herman and Philippe Meunier > > Searching for Deadlocks while Debugging Concurrent Haskell Programs > Jan Christiansen and Frank Huch > > A Nanopass Infrastructure for Compiler Education > Dipanwita Sarkar, Oscar Waddell, and R. Kent Dybvig > > Monadic Regions > Matthew Fluet and Greg Morrisett > > Translating Dependency into Parametricity > Stephen Tse and Steve Zdancewic > > A Type-Theoretic Foundation of Continuations and Prompts > Zena Ariola, Hugo Herbelin, and Amr Sabry, > > Relating Models of Backtracking > Mitchell Wand and Dale Vaillancourt > > Types, potency, and impotency: Why nonlinearity and amnesia make a type > system work > Peter M?ller Neergaard and Harry Mairson > > Numbering Matters: First Order Canonical Forms for Second-Order > Recursive Types > Nadji Gauthier and Fran?ois Pottier > > Process Logic and Duality > Kohei Honda > > Verification of Safety Properties for Concurrent Assembly Code > Dachuan Yu and Zhong Shao > > A Sound (and Complete) Model for Contracts > Matthias Blume and David McAllester > > > ------------------------------------------------------------ > > > > > ------ End of Forwarded Article > > Eric Newhuis Chief Technology Officer FutureSource 630.649.9619 Mobile 630.792.2065 Office 630.792.2600 Fax enewhuis@REDACTED http://www.ifuturesource.com FutureSource | Futures Solutions. Now. The information contained in this e-mail message is legally privileged and confidential information intended only for the use of the individual or entity named above. If the reader of this e-mail message is not the intended recipient, you are hereby notified that any dissemination, distribution or copy of this e-mail is strictly prohibited. If you have received this e mail in error, please contact the sender and immediately delete the original message. Thank you. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: text/enriched Size: 4732 bytes Desc: not available URL: From jamesh@REDACTED Mon Jun 21 19:22:08 2004 From: jamesh@REDACTED (James Hague) Date: Mon, 21 Jun 2004 12:22:08 -0500 Subject: P as far away as ever from the mainstream...... Message-ID: Mike Williams wrote: >See the article below about ICFP 2004. It seems >that Functional Programming is as far away as ever >from mainstream usage. When I first found out about functional programming through the language Hope, what impressed me the most was the simple, native syntax for lists and tuples. At the time, I only knew BASIC, Pascal, maybe a little C, and an 8-bit assembly language. And here was this language that let you cavalierly toss around data structures without regard to memory AT ALL. Now, of course, you can do this kind of thing in most any scripting language, like Python and Perl. The other tenets of FP are much harder to evangelize (and maybe they aren't worth it!). >In fact it still seems that >Erlang is the only functional language which is >making *any* headway in industrial / commercial >applications. Someone else mentioned K, and there is another APL-inspired language, J, which has also made inroads into the world of finance. J is perhaps the closest thing to what Backus talked of in his Turing Award Lectured (and of course Backus was strongly inspired by APL, so this is no surprise). Neither J nor K seem to be discussed in FP circles, however. >And the FP purists don't like us >because Erlang isn't strongly typed and totally >"pure". Part of the problem here may be that people become FP theorists in school, then stay that way forever, all without any real world programming experience. FP is has become an academic exercise. Maybe no one should be able to get a PhD before 40? :) >In retrospect we made a great mistake in promoting >Erlang as an FP. Joe's idea of "concurrency oriented" >languages would have made better >sense..... In promoting it, yes. In terms of language design, no! From ok@REDACTED Tue Jun 22 03:02:08 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Tue, 22 Jun 2004 13:02:08 +1200 (NZST) Subject: FP as far away as ever from the mainstream...... Message-ID: <200406220102.i5M128dG054490@atlas.otago.ac.nz> mike@REDACTED (Mike Williams) wrote: In fact it still seems that Erlang is the only functional language which is making *any* headway in industrial / commercial applications. And the FP purists don't like us because Erlang isn't strongly typed and totally "pure". Now, what would you call a language which - has lazy evaluation for function arguments - has immutable data structures (so that a[i,j] <- f() is really and truly just syntactic sugar for a <- "[<-"(a, i, j, value=f()) ) - has (in one of its implementations) proper functional closures, so that closures can be the results of functions - has a reasonable collection of mapping/reduction functions Doesn't that sound like a functional language? It's the S programming language for statistics. The commercial version (S-Plus) isn't quite as functional as the open source version (R); it's only the open source version which supports proper lexical scopes and closures. It isn't strongly typed, and it isn't totally "pure". But it *has* had substantial headway in industrial/commercial applications; you can do drug trial reporting using it, for example. From david.nospam.hopwood@REDACTED Tue Jun 22 03:48:46 2004 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 22 Jun 2004 02:48:46 +0100 Subject: keepalive timer? In-Reply-To: <200406211629.i5LGTXOr028331@tordmule.bluetail.com> References: <200406211629.i5LGTXOr028331@tordmule.bluetail.com> Message-ID: <40D78FFE.7070704@blueyonder.co.uk> Per Hedeland wrote: > Matthias Lang wrote: > >>It appears that you can't configure the keepalive time on a per-socket >>basis, at least not under linux 2.4.25. > > Actually you can - from live and working code on 2.4.20-ish: > > int one = 1, idle = 60, intvl = 5, cnt = 3; > > setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)); > setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); > setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl)); > setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt)); > > (Those particular values are *not* suitable for your generic TCP session > though.) I think I found documentation of this on some random web page > (typical for Linux:-), it certainly isn't in the man pages. Yes it is: man 7 tcp > But you have the source...:-) > >>Maybe it's possible under >>other operating systems, probably not. I don't know enough about other >>OSs' TCP stacks to answer. > > I'll add my two ?re to the "probably not" vote. TCP_KEEPIDLE et al are not Linux-specific; AFAICS they seem to be supported on all BSD-derived TCP stacks (most Unices including OS X, also OpenVMS, but not Win32). On Win32 there is an IOCTL that sets the equivalent of TCP_KEEPIDLE and TCP_KEEPINTVLs on a per-socket basis: search for WSAIoctl or SIO_KEEPALIVE_VALS. -- David Hopwood From hedeland@REDACTED Tue Jun 22 09:14:01 2004 From: hedeland@REDACTED (Per Hedeland) Date: Tue, 22 Jun 2004 09:14:01 +0200 (CEST) Subject: keepalive timer? In-Reply-To: <40D78FFE.7070704@blueyonder.co.uk> Message-ID: <200406220714.i5M7E1Px066553@tordmule.bluetail.com> David Hopwood wrote: > >Per Hedeland wrote: >> Matthias Lang wrote: >> >>>It appears that you can't configure the keepalive time on a per-socket >>>basis, at least not under linux 2.4.25. >> >> Actually you can - from live and working code on 2.4.20-ish: >> >> int one = 1, idle = 60, intvl = 5, cnt = 3; >> >> setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &one, sizeof(one)); >> setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle)); >> setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &intvl, sizeof(intvl)); >> setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &cnt, sizeof(cnt)); >> >> (Those particular values are *not* suitable for your generic TCP session >> though.) I think I found documentation of this on some random web page >> (typical for Linux:-), it certainly isn't in the man pages. > >Yes it is: man 7 tcp Well, I should have said "...wasn't in the man pages of the Linux distribution where I used them", which was the admittedly dated RedHat 7.3. >> But you have the source...:-) >> >>>Maybe it's possible under >>>other operating systems, probably not. I don't know enough about other >>>OSs' TCP stacks to answer. >> >> I'll add my two ?re to the "probably not" vote. > >TCP_KEEPIDLE et al are not Linux-specific; AFAICS they seem to be supported >on all BSD-derived TCP stacks (most Unices including OS X, also OpenVMS, but >not Win32). Interesting - do you have some other example of "most Unices"? The "BSD- derived" would seem to be misleading, since they're not in the latest and greatest FreeBSD (5.2.1), nor can I find them in the online tcp(4) man pages of current OpenBSD or NetBSD. I also checked the tcp(7P) man page of Solaris 8 and 9, not there either, though I did find an apparently undocumented TCP_KEEPALIVE, that might possibly be a setsockopt combining SO_KEEPALIVE and Linux TCP_KEEPIDLE, in the include files of Solaris 8 (nothing corresponding to TCP_KEEPINTVL/TCP_KEEPCNT though). --Per From bjarne@REDACTED Tue Jun 22 10:41:55 2004 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Tue, 22 Jun 2004 10:41:55 +0200 Subject: FP as far away as ever from the mainstream...... References: Message-ID: <001b01c45834$df0c85a0$a01169d4@segeltorp> FP is in Computer Science like modern classical music, i.e. something esoteric where the success criteria are weirdness and unpopularity. FP becomes an escapism from applications. Bjarne ----- Original Message ----- From: "Mike Williams" To: Sent: Monday, June 21, 2004 9:39 AM Subject: FP as far away as ever from the mainstream...... > See the article below about ICFP 2004. It seems that Functional Programming > is as far away as ever from mainstream usage. In fact it still seems that > Erlang is the only functional language which is making *any* headway > in industrial / commercial applications. And the FP purists don't like > us because Erlang isn't strongly typed and totally "pure". > > In retrospect we made a great mistake in promoting Erlang as an FP. > Joe's idea of "concurrency oriented" languages would have made better > sense..... > > /mike > From thomasl_erlang@REDACTED Tue Jun 22 13:19:27 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Tue, 22 Jun 2004 04:19:27 -0700 (PDT) Subject: FP as far away as ever from the mainstream...... In-Reply-To: Message-ID: <20040622111927.79264.qmail@web41904.mail.yahoo.com> --- Mike Williams wrote: > And the FP > purists don't like > us because Erlang isn't strongly typed and totally > "pure". How about classifying this as a minor annoyance? In the end, it's far more interesting, and vital, to grow the community of developers. The trend also seems to be moving towards not so much type inference as dynamic high-level languages like Python, Ruby and perhaps others we know and love, so there are some reasons to be cheerful. > In retrospect we made a great mistake in promoting > Erlang as an FP. > Joe's idea of "concurrency oriented" languages would > have made better > sense..... Yeah, as a selling point, FP hasn't had a lot of pull :-) It might be easier and more fruitful to attract outsiders who want to get the job done, rather than FP advocates who will likely remain dissatisfied with what Erlang offers. Best, Thomas __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail From kostis@REDACTED Tue Jun 22 18:27:21 2004 From: kostis@REDACTED (Kostis Sagonas) Date: Tue, 22 Jun 2004 18:27:21 +0200 (MEST) Subject: Record selectors (again) Message-ID: <200406221627.i5MGRLS6015483@spikklubban.it.uu.se> This is a plea for a small change to the compilation of the record selector operations in BEAM. Apologies for opening up an old thread, but I cannot see any good excuses for maintaining the following behaviour... The code: ========================================================== -module(rec). -export([unsafely_access_a/1]). -record(rec,{a,b}). unsafely_access_a(R) -> R#rec.a. ========================================================== currently gets preprocessed to: ========================================================== unsafely_access_a(R) -> erlang:element(2,R). ========================================================== which loses all information that the `a' field of an `rec' record is requested. This is VERY user-unfriendly and REALLY error-prone. For example, the following happily returns: 1> rec:unsafely_access_a({gazonk,[total_crap],bar,42}). Modulo returning different exceptions and a slight performance hit (which should not be prohibitive or a reason for not doing this change in OTP), it seems to me that the following code follows the intention of the programmer much more closely: ========================================================== unsafely_access_a(R) -> {rec,A,_} = R, A. ========================================================== Perhaps a better translation than the one I suggest is possible, but clearly something needs to be done about this Erlang-ism... Kostis. From david.nospam.hopwood@REDACTED Tue Jun 22 20:17:42 2004 From: david.nospam.hopwood@REDACTED (David Hopwood) Date: Tue, 22 Jun 2004 19:17:42 +0100 Subject: keepalive timer? In-Reply-To: <200406220714.i5M7E1Px066553@tordmule.bluetail.com> References: <200406220714.i5M7E1Px066553@tordmule.bluetail.com> Message-ID: <40D877C6.8080706@blueyonder.co.uk> Per Hedeland wrote: > David Hopwood wrote: >>TCP_KEEPIDLE et al are not Linux-specific; AFAICS they seem to be supported >>on all BSD-derived TCP stacks (most Unices including OS X, also OpenVMS, but >>not Win32). > > Interesting - do you have some other example of "most Unices"? > The "BSD-derived" would seem to be misleading, since they're not in the > latest and greatest FreeBSD (5.2.1), nor can I find them in the online > tcp(4) man pages of current OpenBSD or NetBSD. You're right -- I was confused by the fact that many stacks use internal variables "tcp_keepidle", etc., but these are not socket options. Taking this into account, I can only find three Unices that support these options: Tru64 (Digital/HP/Compaq), MP-RAS (NCR), and Linux. > I also checked the tcp(7P) man > page of Solaris 8 and 9, not there either, though I did find an > apparently undocumented TCP_KEEPALIVE, that might possibly be a > setsockopt combining SO_KEEPALIVE and Linux TCP_KEEPIDLE, in the include > files of Solaris 8 (nothing corresponding to TCP_KEEPINTVL/TCP_KEEPCNT > though). TCP_KEEPALIVE is defined by the X/Open Transport Interface. At least MAC OS (Open Transport), OS/390, SCO UnixWare, and AIX also support it. See or . -- David Hopwood From vances@REDACTED Tue Jun 22 20:50:45 2004 From: vances@REDACTED (Vance Shipley) Date: Tue, 22 Jun 2004 14:50:45 -0400 Subject: Record selectors (again) In-Reply-To: <200406221627.i5MGRLS6015483@spikklubban.it.uu.se> References: <200406221627.i5MGRLS6015483@spikklubban.it.uu.se> Message-ID: <20040622185045.GB80392@frogman.motivity.ca> On Tue, Jun 22, 2004 at 06:27:21PM +0200, Kostis Sagonas wrote: } -module(rec). } -export([unsafely_access_a/1]). } -record(rec,{a,b}). } } unsafely_access_a(R) -> } R#rec.a. It seems to me that it's up to you to test if the argument is correct or not. Otherwise it is handled through exception handling (i.e. you may want it to crash). unsafely_access_a(R) when is_record(R, rec) -> R#rec.a. -Vance From mscandar@REDACTED Tue Jun 22 22:37:36 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Tue, 22 Jun 2004 16:37:36 -0400 Subject: PPC405? Message-ID: <40D89890.9010906@cisco.com> Two questions: - Has anyone ever gotten Erlang to compile for VxWorks on a PPC405 (for example, the "Walnut" development kit)? - If so, can this be done using vxworks's build environment on windows? Thanks, Mark. From bjorn@REDACTED Wed Jun 23 10:43:27 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Jun 2004 10:43:27 +0200 Subject: Record selectors (again) In-Reply-To: <200406221627.i5MGRLS6015483@spikklubban.it.uu.se> References: <200406221627.i5MGRLS6015483@spikklubban.it.uu.se> Message-ID: Yes, I agree. We also want to change the behaviour to something like unsafely_access_a(R) -> case R of {rec,A,_} -> A; _ -> erlang:fault(badarg) end. similar to how other record operations are handled. Unfortunately, we will probably not have time to do the stricter checking for R10. The reason is that the record access operation could be nested inside an arbitrary expression, and that also need to be handled properly in all cases (probably, the record access needed be lifted out and done before the expression). /Bjorn Kostis Sagonas writes: > This is a plea for a small change to the compilation of the > record selector operations in BEAM. Apologies for opening > up an old thread, but I cannot see any good excuses for > maintaining the following behaviour... > > The code: > ========================================================== > -module(rec). > -export([unsafely_access_a/1]). > -record(rec,{a,b}). > > unsafely_access_a(R) -> > R#rec.a. > ========================================================== > > currently gets preprocessed to: > ========================================================== > unsafely_access_a(R) -> > erlang:element(2,R). > ========================================================== > > which loses all information that the `a' field of an `rec' > record is requested. This is VERY user-unfriendly and REALLY > error-prone. For example, the following happily returns: > > 1> rec:unsafely_access_a({gazonk,[total_crap],bar,42}). > > > Modulo returning different exceptions and a slight performance > hit (which should not be prohibitive or a reason for not doing > this change in OTP), it seems to me that the following code > follows the intention of the programmer much more closely: > > ========================================================== > unsafely_access_a(R) -> > {rec,A,_} = R, > A. > ========================================================== > > Perhaps a better translation than the one I suggest is possible, > but clearly something needs to be done about this Erlang-ism... > > Kostis. > -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From matthias@REDACTED Tue Jun 22 10:14:15 2004 From: matthias@REDACTED (Matthias Lang) Date: Tue, 22 Jun 2004 10:14:15 +0200 Subject: keepalive timer? In-Reply-To: <40D78FFE.7070704@blueyonder.co.uk> References: <200406211629.i5LGTXOr028331@tordmule.bluetail.com> <40D78FFE.7070704@blueyonder.co.uk> Message-ID: <16599.59991.958981.614904@antilipe.corelatus.se> Matthias >>>It appears that you can't Per> > Actually you can [Plus further info from David Hopwood saying that it's possible on many if not most popular OSs] That's what I get for shooting my mouth off without checking the source and without checking the right manpage. Looking at it from Erlang again, gen_tcp currently (R9C) doesn't let you set the keepalive timeout, even if the OS supports doing it on a per-socket basis. And I checked the source before writing that :-). To add it, you'd need to hack it in erts/emulator/drivers/common/inet_drv.c lib/kernel/src/inet.erl lib/kernel/src/prim_inet.erl Matthias From klacke@REDACTED Wed Jun 23 12:55:16 2004 From: klacke@REDACTED (klacke@REDACTED) Date: Wed, 23 Jun 2004 12:55:16 +0200 Subject: Erlang on Mac OS X Panther Message-ID: <20040623105516.GA25519@hyber.org> I've bough meself a mac :-) Anyway, I found the following two problems compiling erlang on Panther OS X 10.3 - Erlang utilize internal zlib functions. In particular z_errstr() The zlib on OS X doesn't have the dunction. # nm /usr/lib/libz.dylib | grep errstr Returns nothing. I solved it by - installing zlib from source in /usr/local - and hacking the generated Makefile to link with /usr/libz.a instead of just -lz SSL application doesn't build correctly either: The link flags contained a -R which gcc doesn't inderstand I just removed the -R. Don't even know what it's supposed to do. /klacke -- Claes Wikstrom -- Caps lock is nowhere and http://www.hyber.org -- everything is under control From bengt.kleberg@REDACTED Wed Jun 23 13:19:50 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Wed, 23 Jun 2004 13:19:50 +0200 Subject: Erlang on Mac OS X Panther In-Reply-To: <20040623105516.GA25519@hyber.org> References: <20040623105516.GA25519@hyber.org> Message-ID: <40D96756.60408@ericsson.com> klacke@REDACTED wrote: >I've bough meself a mac :-) > > > congratulations. ...deleted >SSL application doesn't build correctly either: > > The link flags contained a -R which gcc doesn't inderstand > I just removed the -R. Don't even know what it's supposed to do. > > last time i saw -R it spewcified directories for dynamic linking. something like this (from the manpage of sun-cc): -Rdir[:dir...] A colon-separated list of directories used to specify library search directories to the runtime linker. If present and not null, it is recorded in the output object file and passed to the runtime linker. If both LD_RUN_PATH and the -R option are specified, the -R option takes precedence. bengt From bjorn@REDACTED Wed Jun 23 13:27:35 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Jun 2004 13:27:35 +0200 Subject: Erlang on Mac OS X Panther In-Reply-To: <20040623105516.GA25519@hyber.org> References: <20040623105516.GA25519@hyber.org> Message-ID: klacke@REDACTED writes: > I've bough meself a mac :-) Excellent! :) > > Anyway, I found the following two problems compiling erlang > on Panther OS X 10.3 > > - Erlang utilize internal zlib functions. In particular z_errstr() > The zlib on OS X doesn't have the dunction. > > # nm /usr/lib/libz.dylib | grep errstr > > Returns nothing. I solved it by > - installing zlib from source in /usr/local > - and hacking the generated Makefile > to link with /usr/libz.a instead of just -lz > Erlang comes with its own zlib. In the R9C-2 release, we have changed so that "our" zlib is always linked in. > > > SSL application doesn't build correctly either: > > The link flags contained a -R which gcc doesn't inderstand > I just removed the -R. Don't even know what it's supposed to do. > It is probably needed by some obscure platform. We'll see what we can do about it in future releases. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Wed Jun 23 16:20:38 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 23 Jun 2004 16:20:38 +0200 Subject: OTP R9C-2 has been released Message-ID: Bug fix release : otp_src_R9C-2 Build from snapshot : 2004-06-23 This is a bug fix release 2 for the R9C release. You can download the full source distribution from http://www.erlang.org/download/otp_src_R9C-2.tar.gz http://www.erlang.org/download/otp_src_R9C-2.readme (this file) Note: To unpack the TAR archive you need a GNU TAR compatible program. For instance, on MacOS X you need to use the 'gnutar' command; you can't use the 'tar' command or StuffIt to unpack the sources. For installation instructions please read the README that is part of the distribution. The Windows binary distribution can be downloaded from http://www.erlang.org/download/otp_win32_R9C-2.exe The documentation at http://www.erlang.org will be updated. You can also download the complete HTML documentation or the Unix manual files http://www.erlang.org/download/otp_html_R9C-2.tar.gz http://www.erlang.org/download/otp_man_R9C-2.tar.gz For some OTP applications there are more detailed release notes in the HTML documentation. We also want to thank those that sent us patches, suggestions and bug reports, The OTP Team Changes compared to R9C-1 follows --- erts ------------------------------------------------------------ OTP-5069 Resolved a build problem on Mac OS 10.3 ("Panther"). Because of a conflict with the zlib sources included in the Erlang run-time system and the zlib library included in Panther, linking would fail. Minor optimization on all Unix systems: caching the system name returned from the uname() system call. (Thanks to David N. Welton.) OTP-5075 The functions ets:insert_new/2 and dets:insert_new/2 are added. Please consult the manual pages for details. OTP-5077 New function: proc_lib:hibernate/3. Processes spawned using proc_lib (also indirectly, such as gen_server process), should use this function instead of the BIF erlang:hibernate/3 directly to ensure that the exception handler for the process continues to work when the process is awaken. OTP-5078 A helper for global would terminate if it received unknown types of messages, causing global to terminate too. Changed so that the helper process logs and ignore strange messages. OTP-5080 The ability to set system wide options for TCP sockets is added through the kernel application variables inet_default_listen_options and inet_default_connect_options, see the inet manual page for details. --- kernel ------------------------------------------------------------ OTP-5060 Speed improvements in code:add_path(s)[az]/1 when the cache is activated. OTP-5070 Fixed error that made code server crash if invalid directories were added to the path (introduced in OTP-5060). OTP-5069 Resolved a build problem on Mac OS 10.3 ("Panther"). Because of a conflict with the zlib sources included in the Erlang run-time system and the zlib library included in Panther, linking would fail. Minor optimization on all Unix systems: caching the system name returned from the uname() system call. (Thanks to David N. Welton.) OTP-5075 The functions ets:insert_new/2 and dets:insert_new/2 are added. Please consult the manual pages for details. OTP-5077 New function: proc_lib:hibernate/3. Processes spawned using proc_lib (also indirectly, such as gen_server process), should use this function instead of the BIF erlang:hibernate/3 directly to ensure that the exception handler for the process continues to work when the process is awaken. OTP-5078 A helper for global would terminate if it received unknown types of messages, causing global to terminate too. Changed so that the helper process logs and ignore strange messages. OTP-5080 The ability to set system wide options for TCP sockets is added through the kernel application variables inet_default_listen_options and inet_default_connect_options, see the inet manual page for details. --- megaco ------------------------------------------------------------ OTP-5068 Encoding of a MediaDescriptor fails if the streams part is empty (asn1_NOVALUE). OTP-5085 Failure to encode a ActionReply with empty contextReply (asn1_NOVALUE) and commandReply ([]). Failure to decode ActionReply with error descriptor with non-empty contextReply and/or commandReply. This applies to both version 1 and 2. --- mnesia ------------------------------------------------------------ OTP-5065 Mnesia could hang if mnesia:add_table_copy/3 was called before all tables had been loaded. --- snmp ------------------------------------------------------------ OTP-5084 [agent] Default instrumentation functions mis-behave on some, not supported, tables. Could enter infinit loop. --- stdlib ------------------------------------------------------------ OTP-5069 Resolved a build problem on Mac OS 10.3 ("Panther"). Because of a conflict with the zlib sources included in the Erlang run-time system and the zlib library included in Panther, linking would fail. Minor optimization on all Unix systems: caching the system name returned from the uname() system call. (Thanks to David N. Welton.) OTP-5075 The functions ets:insert_new/2 and dets:insert_new/2 are added. Please consult the manual pages for details. OTP-5077 New function: proc_lib:hibernate/3. Processes spawned using proc_lib (also indirectly, such as gen_server process), should use this function instead of the BIF erlang:hibernate/3 directly to ensure that the exception handler for the process continues to work when the process is awaken. OTP-5078 A helper for global would terminate if it received unknown types of messages, causing global to terminate too. Changed so that the helper process logs and ignore strange messages. OTP-5080 The ability to set system wide options for TCP sockets is added through the kernel application variables inet_default_listen_options and inet_default_connect_options, see the inet manual page for details. -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From enewhuis@REDACTED Wed Jun 23 17:05:45 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Wed, 23 Jun 2004 10:05:45 -0500 Subject: Erlang.NET Message-ID: Microsoft Research just announced this. No they didn't. I toy with you. But what if that existed? What would the implications be? From mickael.remond@REDACTED Wed Jun 23 17:07:23 2004 From: mickael.remond@REDACTED (=?iso-8859-15?Q?Micka=EBl_R=E9mond?=) Date: Wed, 23 Jun 2004 17:07:23 +0200 Subject: OTP R9C-2 has been released In-Reply-To: References: Message-ID: On 23 Jun 2004 16:20:38 +0200, Bjorn Gustavsson wrote: > Bug fix release : otp_src_R9C-2 > Build from snapshot : 2004-06-23 That's nice ! A new version yet ! It seems that you at the OTP team is speeding up the release cycle :-) I will have something to test during the week-end ;-) Cheers, -- Micka?l R?mond http://www.erlang-projects.org/ From rpettit@REDACTED Wed Jun 23 18:47:28 2004 From: rpettit@REDACTED (Rick Pettit) Date: Wed, 23 Jun 2004 11:47:28 -0500 Subject: Erlang.NET In-Reply-To: References: Message-ID: <20040623164728.GA19190@vailsys.com> On Wed, Jun 23, 2004 at 10:05:45AM -0500, Eric Newhuis wrote: > Microsoft Research just announced this. > > No they didn't. I toy with you. Hehe. > But what if that existed? What would the implications be? The idea of mixing functional and imperative programming languages is not a new concept to .NET, as this work has been done with F#. Non-trivial problems exist when getting lazy and strict languages to interoperate. However, it appears as though the work with F# has come a long way. Cross-language extensions already exist, allowing F# to interoperate seamlessly with C#, Visual Basic, SML.NET, etc. The F# compiler is written to allow one to cross-compile a large application as either OCaml bytecode, OCaml native code, or F# code. This allows application developers to write some parts of the application as F# code which makes use of .NET extensions. F# is essentially a .NET implementation of the core of the OCaml programming language (with some design changes and extensions) which specify how ML constructs appear to .NET languages and how to provide access to the .NET library. Presumably similar work could be done with core Erlang/OTP to produce, well, E#? -Rick From thomasl_erlang@REDACTED Wed Jun 23 19:06:10 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Wed, 23 Jun 2004 10:06:10 -0700 (PDT) Subject: Record selectors (again) In-Reply-To: Message-ID: <20040623170610.19715.qmail@web41904.mail.yahoo.com> --- Bjorn Gustavsson wrote: > Yes, I agree. We also want to change the behaviour > to something > like > > unsafely_access_a(R) -> > case R of > {rec,A,_} -> A; > _ -> erlang:fault(badarg) > end. > > similar to how other record operations are handled. Great! I think the general principle should be to avoid having any underlying tuples show through (they are implementation details). > ... the record > access operation > could be nested inside an arbitrary expression, and > that also need > to be handled properly in all cases (probably, the > record access > needed be lifted out and done before the > expression). Why is that? The record check is very much like a type test, so I think it could and should be done right where the operation occurs. (At least conceptually.) The place where this breaks down is inside guards, since they are constrained in what they can look like. (E.g., no if-expressions in guards, so one can't use the translation above.) But instead of lifting out the tests, how about the following: 1. First expand X#rec.fld into a new guard/BIF: record_element(Req_tag, Req_arity, Record, Arg) During compilation, we thus generate something like: % -record(rec, {fld1, fld2, fld3}). X#rec.fld2 => record_element(rec, 3, X, 2) This first checks that X is a record with name 'rec' and three fields, and if so, returns field two. (For example, if the record is implemented as a tuple, this means as usual that X has to be a tuple with 4 elements, where element 1 is the atom 'rec'.) Otherwise it exits/fails. 2. We now have just another BIF, which can be compiled just like all other BIFs that occur in expressions or guards. Also note that an optimizing compiler could convert record_element/4 into element/2 (and further) if it knew that X was the right kind of record. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail From enewhuis@REDACTED Wed Jun 23 20:03:37 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Wed, 23 Jun 2004 13:03:37 -0500 Subject: Erlang.NET In-Reply-To: <20040623164728.GA19190@vailsys.com> References: <20040623164728.GA19190@vailsys.com> Message-ID: (Hi Rick.) A version of Erlang that could live along side Microsoft's Common Language Runtime would possibly result in a nice coupling of Windows GUIs and distributed Erlang. Think: Microsoft is Trojan. CLR is Troy. Erlang.NET is horse. No but really if this existed today FutureSource would use it. No doubt about it. There may be others. We had to spit out yet another binary protocol so our C# application could read our data. We wish we didn't have to transform data types so often in the pipeline. Also harder to test. Wish it were all Erlang except for the graphical bits (of which there are PLENTY). From jay@REDACTED Thu Jun 24 04:56:56 2004 From: jay@REDACTED (Jay Nelson) Date: Wed, 23 Jun 2004 19:56:56 -0700 Subject: Record selectors (again) Message-ID: <4.2.2.20040623194639.0196ece0@duomark.com> > Kostis Sagonas wrote: > -module(rec). > -export([unsafely_access_a/1]). > -record(rec,{a,b}). > > unsafely_access_a(R) -> > R#rec.a. > Vance Shipley replied: > It seems to me that it's up to you to test if the argument is > correct or not. Otherwise it is handled through exception handling > (i.e. you may want it to crash). > unsafely_access_a(R) when is_record(R, rec) -> > R#rec.a. Using the current compiler, the following shorthand way provides the same safety (and is the way I code all my record arguments now): unsafely_access_a(#rec{a=Value}) -> Value. The pattern matcher checks the record type before allowing a successful match. The syntax for the more equivalent approach is: unsafely_access_a(#rec{} = R) -> R#rec.a. jay From ok@REDACTED Thu Jun 24 06:58:31 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Thu, 24 Jun 2004 16:58:31 +1200 (NZST) Subject: Erlang.NET Message-ID: <200406240458.i5O4wVZH099269@atlas.otago.ac.nz> Eric Newhuis wrote: Microsoft Research just announced [Erlang.NET]. No they didn't. I toy with you. But what if that existed? What would the implications be? Just the other day I was reading "Dot-Scheme A PLT Scheme FFI for the .NET framework" by Pedro Pinto (pedro@REDACTED) published in the Fourth Workshop on Scheme and Functional Programming, 2003. ... "The dot-scheme architecture can be thought of as defining two layers: * A core layer, responsible for managing storage of CLR objects as well as CLR method dispatch. This layer is implemented in 1200 lines of Microsoft Managed C++ (MC++). * A code generation layer, responsible for generating wrapper bindings for CLR types. These wrappers are implemented in terms of the primitives supplied by the ocre layer. The code generation layer is implemented in 700 lines of Scheme." If I've understood them correctly, there is a Scheme world using their previous object representation, and CLR objects known to Scheme are held in a hash table; Scheme GC and CLR GC are otherwise independent. It is _not_ a "native" Scheme-to-.NET compilation. That strategy might conceivably work for Erlang. From mickael.remond@REDACTED Thu Jun 24 09:27:10 2004 From: mickael.remond@REDACTED (=?iso-8859-15?Q?Micka=EBl_R=E9mond?=) Date: Thu, 24 Jun 2004 07:27:10 -0000 Subject: Erlang.NET In-Reply-To: <200406240458.i5O4wVZH099269@atlas.otago.ac.nz> References: <200406240458.i5O4wVZH099269@atlas.otago.ac.nz> Message-ID: On Thu, 24 Jun 2004 16:58:31 +1200 (NZST), Richard A. O'Keefe wrote: > Eric Newhuis wrote: > Microsoft Research just announced [Erlang.NET]. > > No they didn't. I toy with you. > > But what if that existed? What would the implications be? I think this could speed up the adoption of Erlang by adding direct access to a huge amount of libraries. This is a good middle term research projet, I think. It could be an extension of Hipe, generating .net bytecode instead of native code ? I do not know however if the execution approach of .net bytecode fits well with Erlang one. It could be interesting to see how it fits with Microsoft Messaging system called Indigo. -- Micka?l R?mond http://www.erlang-projects.org/ From dustin@REDACTED Thu Jun 24 08:26:29 2004 From: dustin@REDACTED (Dustin Sallings) Date: Wed, 23 Jun 2004 23:26:29 -0700 Subject: massive tcp servers Message-ID: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> Does anyone have any experience with massively large tcp servers? I'm doing something like a chat server where there will be many, many connections simultaneously along with some mechanism for addressing those connections. Does anyone have any idea what might be required to have something on the order of 10,000,000 concurrent connections in a cluster. Obviously I want as small of a cluster as possible for hardware costs. I also get the impression that large clusters may not be that easy to scale. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From spearce@REDACTED Thu Jun 24 09:00:02 2004 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 24 Jun 2004 03:00:02 -0400 Subject: massive tcp servers In-Reply-To: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> References: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> Message-ID: <20040624070002.GE16740@spearce.org> Dustin Sallings wrote: > > Does anyone have any experience with massively large tcp servers? > I'm doing something like a chat server where there will be many, many > connections simultaneously along with some mechanism for addressing > those connections. Does anyone have any idea what might be required to > have something on the order of 10,000,000 concurrent connections in a > cluster. Obviously I want as small of a cluster as possible for > hardware costs. I also get the impression that large clusters may not > be that easy to scale. http://www.sics.se/~joe/apachevsyaws.html Erlang will easily take 80,000 connections on some OSes and still keep a pretty good throughput. 10 million connections may take quite a few machines; I'd expect you would want to be hitting around 100k-200k TCP connections per physical computer, with about 10k-80k TCP connections per Erlang node. 100k/computer = 100 computers. But what do I know. :) Its really a function of how much work you need each to do, Erlang's IO system on some platforms is pretty capable of going to large numbers of file descriptors. On others, I think its lucky to get 1024 without making the C libraries choke (FD_SET size limits). The real limiting factor might just be the CPU load of your application, requiring you to use even more systems than you would like. Because if you do much more than just act as a data pump, most of your nodes will be overwhelmed with 80k connections. I assume you have at least researched IRC? It might not entirely fit with your problem domain, but it does sort of fit into the "building a very big cluster to support a very large number of connections from a very large number of clients" arena. At the very least it offers some lessons learned, and some good do's and don'ts. -- Shawn. From bry@REDACTED Thu Jun 24 10:14:57 2004 From: bry@REDACTED (bry@REDACTED) Date: Thu, 24 Jun 2004 10:14:57 +0200 Subject: ASAP protocol Message-ID: <1088064897.40da8d81d0d8c@horde.scannet.dk> Reading this, and remember the discussion about an xml protocol resolver Joe was talking about a while back, it struck me that this was actually the kind of thing I could see being well-suited to erlang. From bry@REDACTED Thu Jun 24 10:15:41 2004 From: bry@REDACTED (bry@REDACTED) Date: Thu, 24 Jun 2004 10:15:41 +0200 Subject: ASAP protocol link Message-ID: <1088064941.40da8dad813bd@horde.scannet.dk> http://searchwebservices.techtarget.com/qna/0,289202,sid26_gci989925,00.html I think I forgot it in the first post. From thomasl_erlang@REDACTED Thu Jun 24 11:04:38 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Thu, 24 Jun 2004 02:04:38 -0700 (PDT) Subject: Record selectors (again) Message-ID: <20040624090438.83093.qmail@web41902.mail.yahoo.com> This one seems never to have reached the list, so I'll resend it. --- Thomas Lindgren wrote: > Date: Wed, 23 Jun 2004 10:06:10 -0700 (PDT) > From: Thomas Lindgren > Subject: Re: Record selectors (again) > To: Bjorn Gustavsson , > erlang-questions@REDACTED --- Bjorn Gustavsson wrote: > Yes, I agree. We also want to change the behaviour > to something > like > > unsafely_access_a(R) -> > case R of > {rec,A,_} -> A; > _ -> erlang:fault(badarg) > end. > > similar to how other record operations are > handled. Great! I think the general principle should be to avoid having any underlying tuples show through (they are implementation details). > ... the record > access operation > could be nested inside an arbitrary expression, > and > that also need > to be handled properly in all cases (probably, the > record access > needed be lifted out and done before the > expression). Why is that? The record check is very much like a type test, so I think it could and should be done right where the operation occurs. (At least conceptually.) The place where this breaks down is inside guards, since they are constrained in what they can look like. (E.g., no if-expressions in guards, so one can't use the translation above.) But instead of lifting out the tests, how about the following: 1. First expand X#rec.fld into a new guard/BIF: record_element(Req_tag, Req_arity, Record, Arg) During compilation, we thus generate something like: % -record(rec, {fld1, fld2, fld3}). X#rec.fld2 => record_element(rec, 3, X, 2) This first checks that X is a record with name 'rec' and three fields, and if so, returns field two. (For example, if the record is implemented as a tuple, this means as usual that X has to be a tuple with 4 elements, where element 1 is the atom 'rec'.) Otherwise it exits/fails. 2. We now have just another BIF, which can be compiled just like all other BIFs that occur in expressions or guards. Also note that an optimizing compiler could convert record_element/4 into element/2 (and further) if it knew that X was the right kind of record. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail From luke@REDACTED Thu Jun 24 11:34:54 2004 From: luke@REDACTED (Luke Gorrie) Date: Thu, 24 Jun 2004 11:34:54 +0200 Subject: massive tcp servers In-Reply-To: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> (Dustin Sallings's message of "Wed, 23 Jun 2004 23:26:29 -0700") References: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> Message-ID: Dustin Sallings writes: > Does anyone have any experience with massively large tcp > servers? I'm doing something like a chat server where there will be > many, many connections simultaneously along with some mechanism for > addressing those connections. Does anyone have any idea what might be > required to have something on the order of 10,000,000 concurrent > connections in a cluster. Obviously I want as small of a cluster as > possible for hardware costs. I also get the impression that large > clusters may not be that easy to scale. Oh, oh, oh, that sounds like fun! I'm assuming that most of these users will be idle most of the time, and each will use a small amount of overall bandwidth. Entering fantasy land here.. My first thought is that the OS will have trouble with that many connections. I'm not certain of the per-connection overhead, but looking at the 'tcp_opt' struct in include/linux/tcp.h at least it looks significant. If you wrote your own TCP (or simpler custom protocol) in userspace then maybe you could pull it off with just one box. You could keep the TCP control structures in a database on disk and map the active ones into a large-but-bounded-size pool in memory. I have only limited experience with hacking TCP/IP, but my impression is that writing your own TCP is probably no harder than e.g. writing a good HTTP/1.1 implementation. I recommend the first two volumes of Douglas Comer's networking series, in turn recommended to me by Tobbe from when he wrote a TCP in Erlang. On Linux I think the most practical option would be to use a 'tun' interface (linux/Documentation/networking/tuntap.txt), which allows you to write a user-space network interface that operates at IP-level (rather than ethernet-level). That way you can use Linux's IPv4 implementation and only worry about TCP yourself. -Luke From bjorn@REDACTED Thu Jun 24 13:23:31 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 24 Jun 2004 13:23:31 +0200 Subject: Record selectors (again) In-Reply-To: <20040623170610.19715.qmail@web41904.mail.yahoo.com> References: <20040623170610.19715.qmail@web41904.mail.yahoo.com> Message-ID: Thomas Lindgren writes: > --- Bjorn Gustavsson wrote: > > ... the record > > access operation > > could be nested inside an arbitrary expression, and > > that also need > > to be handled properly in all cases (probably, the > > record access > > needed be lifted out and done before the > > expression). > > Why is that? The record check is very much like a type > test, so I think it could and should be done right > where the operation occurs. (At least conceptually.) Yes, conceptually it should occur right where the operation occurs. After some more thinking, it occurred to me that the code could be transformed like follows. If the original code looks like this -record(vec, {x,y,z}). t(R) -> 2*R#vec.x+1. the compiler could first rewrite the expression like this t(R) -> 2*begin #vec{x=X}=R, X end+1. which would ultimately be translated to t2(R) -> 2 * begin {vec,X,_,_} = R, X end + 1. That will currently not work in a guard, so guards would have to be handled in another way. One way would be allow matching in guards (only for compiler-generated code); another could be to introduce a new guard BIF similar to what Thomas suggested. Maybe, just maybe, this change could make it into R10. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From bjorn@REDACTED Thu Jun 24 13:27:29 2004 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 24 Jun 2004 13:27:29 +0200 Subject: Record selectors (again) In-Reply-To: <4.2.2.20040623194639.0196ece0@duomark.com> References: <4.2.2.20040623194639.0196ece0@duomark.com> Message-ID: Jay Nelson writes: > > Using the current compiler, the following > shorthand way provides the same safety (and is the way I > code all my record arguments now): > > unsafely_access_a(#rec{a=Value}) -> > Value. > That is my prefered way of writing record expressions; I almost never use the R#rec.field notation. But many (most?) Erlang programmers use the R#rec.field notation, so the compiler should ideally give them too as early fault detection as possible. /Bjorn -- Bj?rn Gustavsson, Erlang/OTP, Ericsson AB From joe@REDACTED Thu Jun 24 13:49:55 2004 From: joe@REDACTED (Joe Armstrong) Date: Thu, 24 Jun 2004 13:49:55 +0200 (CEST) Subject: massive tcp servers In-Reply-To: Message-ID: > If you wrote your own TCP (or simpler custom protocol) in userspace > then maybe you could pull it off with just one box. You could keep the > TCP control structures in a database on disk and map the active ones > into a large-but-bounded-size pool in memory. > > I have only limited experience with hacking TCP/IP, but my impression > is that writing your own TCP is probably no harder than e.g. writing a > good HTTP/1.1 implementation. I recommend the first two volumes of > Douglas Comer's networking series, in turn recommended to me by Tobbe > from when he wrote a TCP in Erlang. I suspect it might be pretty easy - Adam Dunkels wrote a TCP/IP "thingy" in PHP - not a full TCP but just enough to answer an HTTP request see http://www.sics.se/~adam/phpstack/ I talked to Adam he said it took him "3 hours" - including the time to learn PHP - now Adam has admittedly implemented TCP many times - but staring at his code might provide some inspiration. If you wrote "enough" TCP to just handle a HTTP request you might come up with a pretty high performance, highly concurrent web server - who knows. IMHO the tricky bit is making a tunnel so that a regular Erlang program can see the raw IP datagrams - the rest is just plain coding. Luke sees to have some code that does this bit - (am I right Luke). Cheers /Joe > > On Linux I think the most practical option would be to use a 'tun' > interface (linux/Documentation/networking/tuntap.txt), which allows > you to write a user-space network interface that operates at IP-level > (rather than ethernet-level). That way you can use Linux's IPv4 > implementation and only worry about TCP yourself. > > -Luke > From luke@REDACTED Thu Jun 24 13:57:05 2004 From: luke@REDACTED (Luke Gorrie) Date: Thu, 24 Jun 2004 13:57:05 +0200 Subject: massive tcp servers In-Reply-To: (Joe Armstrong's message of "Thu, 24 Jun 2004 13:49:55 +0200 (CEST)") References: Message-ID: Joe Armstrong writes: > IMHO the tricky bit is making a tunnel so that a regular Erlang > program can see the raw IP datagrams - the rest is just plain coding. > > Luke sees to have some code that does this bit - (am I right Luke). That part is actually easy, and yes, the 'tuntap' application in the Jungerl does it. We've used that in production code. -Luke From hal@REDACTED Thu Jun 24 15:35:06 2004 From: hal@REDACTED (Hal Snyder) Date: Thu, 24 Jun 2004 08:35:06 -0500 Subject: massive tcp servers In-Reply-To: <20040624070002.GE16740@spearce.org> (Shawn Pearce's message of "Thu, 24 Jun 2004 03:00:02 -0400") References: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> <20040624070002.GE16740@spearce.org> Message-ID: <87n02trsdx.fsf@ghidra.vail> Shawn Pearce writes: > Dustin Sallings wrote: >> >> Does anyone have any experience with massively large tcp servers? >> I'm doing something like a chat server where there will be many, many >> connections simultaneously along with some mechanism for addressing >> those connections. Does anyone have any idea what might be required to >> have something on the order of 10,000,000 concurrent connections in a >> cluster. Obviously I want as small of a cluster as possible for >> hardware costs. I also get the impression that large clusters may not >> be that easy to scale. > > http://www.sics.se/~joe/apachevsyaws.html > > Erlang will easily take 80,000 connections on some OSes and still > keep a pretty good throughput. > > 10 million connections may take quite a few machines; I'd expect > you would want to be hitting around 100k-200k TCP connections per > physical computer, with about 10k-80k TCP connections per Erlang node. > 100k/computer = 100 computers. Jonathan Lemon's kqueue paper discusses of large numbers of TCP connections, testing HTTP sessions with and without kernel event delivery. ... The unmodified thttpd server runs out of cpu when the number of idle connections is around 600, while the modified server still has approximately 48% idle time with 10,000 idle connections. http://www.cs.princeton.edu/courses/archive/fall03/cs518/papers/kqueue.pdf From enewhuis@REDACTED Thu Jun 24 16:12:59 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Thu, 24 Jun 2004 09:12:59 -0500 Subject: Did Erlang borrow from Ada? In-Reply-To: <02e101c45965$8e858320$6601a8c0@netgateway> References: <02e101c45965$8e858320$6601a8c0@netgateway> Message-ID: <98EE7344-C5E8-11D8-B933-000A95D9A520@futuresource.com> Did Erlang borrow from Ada? Hm. I am not sure. I've CC'd this question to the Erlang mailing lists to see if Joe Armstrong might comment. Unencumbered by facts, however, I will offer the following opinion. I don't see anything in Erlang that resembles Ada programming constructs. But the concurrency is there. I think no especially if you are comparing the grammars. Erlang derived from Prolog and then got rid of most of what Prolog does at runtime. So the code tends to look like Prolog but has a completely different meaning. But because of this there is a lot of Erlang code that looks declarative--just long lists of "facts" and "rules" instead of algorithms. However there are plenty of algorithms expressed in Erlang. (Whereas in Prolog there is only one algorithm and it is built in to the Prolog runtime engine. Prolog is a giant search engine and your program is the database. You run the program by asking Prolog a question about its facts. Erlang is nothing like that at all. Not even close. But the grammar looks the same.) -Eric From joe@REDACTED Thu Jun 24 16:59:07 2004 From: joe@REDACTED (Joe Armstrong) Date: Thu, 24 Jun 2004 16:59:07 +0200 (CEST) Subject: Did Erlang borrow from Ada? In-Reply-To: <98EE7344-C5E8-11D8-B933-000A95D9A520@futuresource.com> Message-ID: On Thu, 24 Jun 2004, Eric Newhuis wrote: > Did Erlang borrow from Ada? Not knowingly :-) The main influences were Prolog, Eri-pascal, PLEX and chill and SDL. Erlang was developed at the Ericsson Computer Science Lab. Our job was to "find better ways of programming telephony". Ericsson has previous made in-house languages (PLEX and erl-pascal) for telephony programming. The "PLEX tradition" was for languages with massive concurrency, lightweight processes fast context switching fast message passing etc. PLEX program were specified in SDL and in the mid 80's executable specification language were trendy - Erlang's receive semantics (wait for what you want and queue everything else) came from an attempt to simplify the transformation of SDL specifications into code. Things like "changing code on the fly" came from the requirements for telecoms systems (which are supposed to be non-stop). Erlang started life as a Prolog meta-interpretor. Erlang one was just a Prolog meta-interpretor which emulated parallel processes and message passing. The error recovery semantics was added later. As time passed the Prology features (search, backtracking, passing unbound variables) faded away - to be replaced with more functional things Higher order functions, list comprehensions. As time passed a lot of pragmatic things got added, the Bit syntax ... etc. Cheers /Joe > > Hm. I am not sure. I've CC'd this question to the Erlang mailing > lists to see if Joe Armstrong might comment. Unencumbered by facts, > however, I will offer the following opinion. > > I don't see anything in Erlang that resembles Ada programming > constructs. But the concurrency is there. > > I think no especially if you are comparing the grammars. Erlang > derived from Prolog and then got rid of most of what Prolog does at > runtime. So the code tends to look like Prolog but has a completely > different meaning. But because of this there is a lot of Erlang code > that looks declarative--just long lists of "facts" and "rules" instead > of algorithms. However there are plenty of algorithms expressed in > Erlang. (Whereas in Prolog there is only one algorithm and it is built > in to the Prolog runtime engine. Prolog is a giant search engine and > your program is the database. You run the program by asking Prolog a > question about its facts. Erlang is nothing like that at all. Not > even close. But the grammar looks the same.) > > -Eric > From jamesh@REDACTED Thu Jun 24 16:59:12 2004 From: jamesh@REDACTED (James Hague) Date: Thu, 24 Jun 2004 09:59:12 -0500 Subject: Did Erlang borrow from Ada? Message-ID: >Whereas in Prolog there is only one algorithm >and it is built in to the Prolog runtime engine. >Prolog is a giant search engine and your program >is the database. You run the program by asking >Prolog a question about its facts. That's not really true. You can write algorthims in Prolog just like Erlang. From bjarne@REDACTED Thu Jun 24 17:18:17 2004 From: bjarne@REDACTED (=?iso-8859-1?Q?Bjarne_D=E4cker?=) Date: Thu, 24 Jun 2004 17:18:17 +0200 Subject: Did Erlang borrow from Ada? References: <02e101c45965$8e858320$6601a8c0@netgateway> <98EE7344-C5E8-11D8-B933-000A95D9A520@futuresource.com> Message-ID: <001901c459fe$9a4cb4a0$ab1d69d4@segeltorp> Hello > Did Erlang borrow from Ada? In my licentiate thesis from the year 2000, I wrote: "Erlang is aptly described as a concurrent functional programming language combining two main traditions: - Concurrent programming languages: Modula, Chill, Ada, etc. from ehich Erlang inherits modules, processes, and process communication. - Functional and logic programming languages: Haskell, ML, Miranda, Lisp, etc. from which Erlang inherits atoms, lists, guards, pattern matching, catch and throw, etc." Have a nice summer Bjarne From tony@REDACTED Thu Jun 24 17:34:17 2004 From: tony@REDACTED (Tony Rogvall) Date: Thu, 24 Jun 2004 17:34:17 +0200 Subject: Did Erlang borrow from Ada? In-Reply-To: Message-ID: torsdagen den 24 juni 2004 kl 16.59 skrev James Hague: >> Whereas in Prolog there is only one algorithm >> and it is built in to the Prolog runtime engine. >> Prolog is a giant search engine and your program >> is the database. You run the program by asking >> Prolog a question about its facts. > > That's not really true. You can write algorthims in Prolog just like > Erlang. > Yes, but then why use Prolog ? I have seen Prolog programs written by "Algol" programmers, they tend to put in cuts in the code until the backtracking stops :-) /Tony From rvg@REDACTED Thu Jun 24 17:45:32 2004 From: rvg@REDACTED (Rudolph van Graan) Date: Thu, 24 Jun 2004 17:45:32 +0200 Subject: SASL Question Message-ID: <8691AB32-C5F5-11D8-AF1E-000A956D87EE@patternmatched.com> Hi All, Quick question... I've configured SASL like this: {sasl,[ {sasl_error_logger,{file,"/var/log/erl/error.log"}} And like this {sasl,[ {sasl_error_logger,{file,"/var/log/erl/error.log"}}, {errlog_type,error} In both cases I get SASL to log me progress reports and supervisor reports into the specified file. Things like this: =PROGRESS REPORT==== 24-Jun-2004::15:38:14 === application: app started_at: app@REDACTED The problem is this: I don't see any error reports or anything again after startup, ever. It seems that SASL just stops recording error reports and ignores the error reports. I am sure that a lot of error reports occur, but for the life of me I cannot seem to convince SASL to log them for me. Is there anything obvious I miss? While I'm at it... SASL also seems to delete the log file everytime the erl VM is restarted. Why is this and how do I convince it not to do this and to simply append to the current one? Regards, Rudolph van Graan From jerome@REDACTED Thu Jun 24 22:38:02 2004 From: jerome@REDACTED (=?ISO-8859-1?Q?J=E9r=F4me_Desquilbet?=) Date: Thu, 24 Jun 2004 22:38:02 +0200 Subject: Did Erlang borrow from Ada? In-Reply-To: <001901c459fe$9a4cb4a0$ab1d69d4@segeltorp> References: <02e101c45965$8e858320$6601a8c0@netgateway> <98EE7344-C5E8-11D8-B933-000A95D9A520@futuresource.com> <001901c459fe$9a4cb4a0$ab1d69d4@segeltorp> Message-ID: <63210362-C61E-11D8-A1D6-003065E00134@desquilbet.org> As a side note, for those who might be interested in the next version of Ada, Ada'05 (after Ada'83 and Ada'95): http://www.cs.kuleuven.ac.be/~dirk/ada-belgium/events/04/040616-aec- ada2005.pdf J?r?me. Le 24 juin 04, ? 17:18, Bjarne D?cker a ?crit : > Hello > >> Did Erlang borrow from Ada? > > In my licentiate thesis from the year 2000, > I wrote: > > "Erlang is aptly described as a concurrent functional > programming language combining two main traditions: > > - Concurrent programming languages: Modula, Chill, > Ada, etc. from ehich Erlang inherits modules, > processes, and process communication. > > - Functional and logic programming languages: Haskell, > ML, Miranda, Lisp, etc. from which Erlang inherits > atoms, lists, guards, pattern matching, catch and > throw, etc." > > Have a nice summer > > Bjarne > > From erlang-list@REDACTED Fri Jun 25 01:43:14 2004 From: erlang-list@REDACTED (Dominic Williams) Date: Fri, 25 Jun 2004 01:43:14 +0200 Subject: Erlang.NET In-Reply-To: References: Message-ID: <42E1A13A-C638-11D8-8F17-00039386EAAE@dominicwilliams.net> Le 23 juin 04, ? 17:05, Eric Newhuis a ?crit : > Microsoft Research just announced this. > > No they didn't. I toy with you. > > But what if that existed? What would the implications be? I had my first day (out of 2) .NET training today, and was bored enough that I spent most of the time thinking about exactly that question! My feeling from such a superficial introduction is that the CLR (common language runtime) is far too close to the traditional object-oriented view of things for it to be easy to fit Erlang into that mould. By the way, Eiffel, my favourite language before I discovered Erlang, went this route and lost its soul (although it was much less of a stretch for Eiffel than it would be for Erlang). Time will tell whether ISE will gain any market shares by this move. I sometimes think there is more, strategically, to be said for staying very different that from trying to blend with the mainstream... On the other hand, it would be easy to write a gen_ws, which would automatically wrap a gen_server and make it into a web service, and vice-versa (make a web service available to erlang processes via Erlang send/receive...) But it's hard to get excited about the idea... Dominic Williams http://www.dominicwilliams.net ---- From ok@REDACTED Fri Jun 25 03:21:06 2004 From: ok@REDACTED (Richard A. O'Keefe) Date: Fri, 25 Jun 2004 13:21:06 +1200 (NZST) Subject: Did Erlang borrow from Ada? Message-ID: <200406250121.i5P1L6l0115447@atlas.otago.ac.nz> As someone who has had a great deal to do with Prolog, I must say that I find the claim that Prolog has only one algorithm ABSURD, and the claim that algorithms written in Prolog have lots of cuts, um, ill-informed. If I recall Koawlski's phrase correctly, it was Logic + Control = Algorithm These days, by the way, many of the more popular Prolog systems do a lot more than unification and backtracking. They support constraint logic programming, to a greater or lesser degree. The built-in "control" is getting a bit more data-flow-driven. However, anything you can program in a functional language, you can program in Prolog, and in much the same way. And when you discover that SWI Prolog supports multi-thread programming (and even, sigh, has an analogue of the process dictionary), you realise that from Erlang to some modern Prologs could be quite a short step. (OTP, now, that's another matter.) Hmm. There's an Erlang-to-Scheme compiler. Anyone for an Erlang-to-SWI-Prolog compiler? (:-) From vances@REDACTED Fri Jun 25 04:45:44 2004 From: vances@REDACTED (Vance Shipley) Date: Thu, 24 Jun 2004 22:45:44 -0400 Subject: vsn attribute Message-ID: <20040625024530.GM80392@frogman.motivity.ca> How is the vsn attribute used these days? I see the OTP folks have stopped using it although the users guide for sasl still recommends it. It seems that a strange value is always assigned if you don't supply one yourself. The vsn attribute shows up in Module:module_info/0 as defined when present: -vsn("0.1"). {attributes,[{vsn,"0.1"}]} Or as a strange number when not: {attributes,[{vsn,[69329816276472662871214444589331338499]}]} -Vance From vances@REDACTED Thu Jun 24 19:02:03 2004 From: vances@REDACTED (Vance Shipley) Date: Thu, 24 Jun 2004 13:02:03 -0400 Subject: SASL Question In-Reply-To: <8691AB32-C5F5-11D8-AF1E-000A956D87EE@patternmatched.com> References: <8691AB32-C5F5-11D8-AF1E-000A956D87EE@patternmatched.com> Message-ID: <20040624170203.GJ80392@frogman.motivity.ca> Rudolph, It would seem that you have discovered a bug. You might want to look at run_erl to achieve what you want. If you run a proper embedded system you can leave sasl outputting to tty and the run_erl program will handle logging to rotating files. You can use to_erl to attach to the shell. -Vance On Thu, Jun 24, 2004 at 05:45:32PM +0200, Rudolph van Graan wrote: } } The problem is this: I don't see any error reports or anything again } after startup, ever. It seems that SASL just stops recording error } reports and ignores the error reports. I am sure that a lot of error } reports occur, but for the life of me I cannot seem to convince SASL to } log them for me. Is there anything obvious I miss? } } While I'm at it... SASL also seems to delete the log file everytime the } erl VM is restarted. Why is this and how do I convince it not to do } this and to simply append to the current one? } } Regards, } } Rudolph van Graan } From dustin@REDACTED Fri Jun 25 08:10:38 2004 From: dustin@REDACTED (Dustin Sallings) Date: Thu, 24 Jun 2004 23:10:38 -0700 Subject: massive tcp servers In-Reply-To: References: <6D444A10-C5A7-11D8-9D94-000A957659CC@spy.net> Message-ID: <60EA9B51-C66E-11D8-A9D6-000A957659CC@spy.net> On Jun 24, 2004, at 2:34, Luke Gorrie wrote: > Oh, oh, oh, that sounds like fun! Yeah, I think this project is a really stupid idea, but it's a fascinating problem. :) > I'm assuming that most of these users will be idle most of the time, > and each will use a small amount of overall bandwidth. Yep. > Entering fantasy land here.. > > My first thought is that the OS will have trouble with that many > connections. I'm not certain of the per-connection overhead, but > looking at the 'tcp_opt' struct in include/linux/tcp.h at least it > looks significant. Yep, (although I was thinking about using FreeBSD or something). Does erlang use /dev/poll? > If you wrote your own TCP (or simpler custom protocol) in userspace > then maybe you could pull it off with just one box. You could keep the > TCP control structures in a database on disk and map the active ones > into a large-but-bounded-size pool in memory. That is just completely amazing. It seems like the obvious and likely only solution to the problem. You've given me a lot to think about. Thanks a lot. -- SPY My girlfriend asked me which one I like better. pub 1024/3CAE01D5 1994/11/03 Dustin Sallings | Key fingerprint = 87 02 57 08 02 D0 DA D6 C8 0F 3E 65 51 98 D8 BE L_______________________ I hope the answer won't upset her. ____________ From davidw@REDACTED Fri Jun 25 11:29:45 2004 From: davidw@REDACTED (David N. Welton) Date: Fri, 25 Jun 2004 11:29:45 +0200 Subject: "Hecl" - scripting for erlang Message-ID: <40DBF089.5010804@eidetix.com> Hi, I've put together a simple command language interpreter for Erlang. My plan is to use it with yaws, but I think it might be useful for other things as well. For instance, you could add some simple scripting capabilities to an application to let end users write simple commands for it, giving users more or less commands, as you see fit. It is Tcl-like in nature, meaning that it does string interpolation and makes it easy to print things out, whatever their type. It is complementary to, and subordinate to Erlang. It's meant as a library that you could add to your app to do some simple work (it's pretty slow). For the moment, I have placed it at http://dedasys.com/freesoftware/files/hecl.tgz although if people were interested, I suppose I could add it to jungerl. I'm sure it's quite evident that I haven't been programming seriously in Erlang for too long, so constructive criticism is appreciated (although it might be nice to keep any really embarassing mistakes in private mail:-) It's not finished either, there are still some big things to fix with it, but I thought I'd let it loose to see if anyone else would like to have a look. -- David N. Welton davidw@REDACTED From thomasl_erlang@REDACTED Fri Jun 25 12:02:33 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 25 Jun 2004 03:02:33 -0700 (PDT) Subject: Did Erlang borrow from Ada? In-Reply-To: Message-ID: <20040625100233.42570.qmail@web41901.mail.yahoo.com> --- Tony Rogvall wrote: > > torsdagen den 24 juni 2004 kl 16.59 skrev James > Hague: > > > That's not really true. You can write algorthims > in Prolog just like > > Erlang. > > > Yes, but then why use Prolog ? You still have logic variables, of course. And why search when there is no need for it? Where's your programmer pride, man? :-) > I have seen Prolog programs written by "Algol" > programmers, they tend to > put in cuts in the code until the backtracking stops > :-) You can write FORTRAN in any language ... But, as you hint, Prolog probably suffered more than others from never having the execution model explained clearly enough for the beginners. Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From francesco@REDACTED Fri Jun 25 13:45:21 2004 From: francesco@REDACTED (Francesco Cesarini) Date: Fri, 25 Jun 2004 12:45:21 +0100 Subject: ACM SIGPLAN Erlang Workshop Papers Message-ID: <40DC1051.3030107@erlang-consulting.com> On behalf of the program Committee for the Erlang Workshop in Snowbird, Slat Lake City (Utah), I am happy to congratulate the authors of the 10 papers we have accepted. Five of them will give 30 minute presentations, and the remaining five 15 minute ones. We will have two invited talks, one from John Hughes, Chalmers University, Sweden, and one from Danie Schutte, Teba Bank/Cell Transact, South Africa. So as to allow companies and research institutions to participate without having to submit, we hope to include a SIP session, where on a first come first serve basis. Participants will be able to give 5 minute presentations on their Erlang products, research, and more. We will be going out with more information on them soon. The accepted papers (In no particular order) are: Troubleshooting a Large Erlang System Mats Cronqvist EX11 - A GUI in a concurrent functional language Joe Armstrong Erlang's Exception Handling Revisited Richard Carlsson, Bjorn Gustavsson, Patrik Nyblom HiPE on AMD64 Daniel Luna, Mikael Pettersson, Konstantinos Sagonas Structured Programming Using Processes Jay Nelson Monitoring and State Transparency of Distributed Systems Martin Logan An External Short Message Entity for Gambling Services Enrique Marcote, Daniel Iglesia, Carlos Escudero An implementation of SMB protocol in Erlang Torbj?rn T?rnkvist On Modelling Agent Systems with Erlang Carlos Varela, Carlos Abalde, Laura Castro, Jose Gulias Flow Graphs for Testing Sequential Erlang Programs Manfred Widera See you all in Snowbird! Francesco Cesarini on behalf of the program committee. -- http://www.erlang-consulting.com From Marc.Vanwoerkom@REDACTED Fri Jun 25 13:47:03 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Fri, 25 Jun 2004 13:47:03 +0200 Subject: Did Erlang borrow from Ada? In-Reply-To: <20040625100233.42570.qmail@web41901.mail.yahoo.com> Message-ID: >But, as you hint, Prolog probably suffered more than >others from never having the execution model explained >clearly enough for the beginners. I got Turbo Prolog on a 5.25" floppy about 15 years ago, and I had absolutely no clue what it was about. Few years ago, I encountered it in a computer science lecture on logical and functional programming. Then I understood the basic principle a bit better. I know the unification algorithm from reading it, but if I wanted to come up with a similiar one, I probably need a theoretical computer science lecture on logic to understand why it works that way. So the theoretical overhead is much higher, than with other languages. Perhaps one can use prolog without knowing the details, I don't know. I would not feel very comfortable that way. On the other hand, knowing that a system like prolog gives the same resuls like a imperative language, was one of the highlights of my present studies in computer science, probably one of the bits that makes the difference to just a programmer. Java, on the other hand, frustrated me, because it seemed so much like a C++ for dummies language. It will be interesting to see, if the average future software development stays on a level like Java/VB/PHP.. or if there will be more advances. Programming today uses more theory than the languages of the 80ies, so there is some progress. But I somehow doubt that the mainstream will pick up advanced stuff like prolog, standard ml, Erlang, haskell, ocaml and so on. Regards, Marc From enewhuis@REDACTED Fri Jun 25 14:04:28 2004 From: enewhuis@REDACTED (Eric Newhuis) Date: Fri, 25 Jun 2004 07:04:28 -0500 Subject: Did Erlang borrow from Ada? In-Reply-To: References: Message-ID: > But I somehow doubt that the mainstream will pick up advanced stuff > like prolog, standard ml, Erlang, haskell, ocaml and so on. If they ever do pick it up I may lose a competitive advantage. Sh. Don't tell anyone. From tony@REDACTED Fri Jun 25 15:44:58 2004 From: tony@REDACTED (Tony Rogvall) Date: Fri, 25 Jun 2004 15:44:58 +0200 Subject: Did Erlang borrow from Ada? In-Reply-To: <20040625100233.42570.qmail@web41901.mail.yahoo.com> Message-ID: fredagen den 25 juni 2004 kl 12.02 skrev Thomas Lindgren: > --- Tony Rogvall wrote: >> >> torsdagen den 24 juni 2004 kl 16.59 skrev James >> Hague: >> >>> That's not really true. You can write algorthims >> in Prolog just like >>> Erlang. >>> >> Yes, but then why use Prolog ? > > You still have logic variables, of course. And why > search when there is no need for it? Where's your > programmer pride, man? :-) > Do not get me wrong, I like Prolog. But to use it you must learn programming from scratch or put in a lot of cuts :-) (in Erlang you only need to learn and master recursion) /Tony From jamesh@REDACTED Fri Jun 25 16:01:25 2004 From: jamesh@REDACTED (James Hague) Date: Fri, 25 Jun 2004 09:01:25 -0500 Subject: The Great Computer Language Shootout is back Message-ID: Someone else picked it up: http://shootout.alioth.debian.org/ If there are changes to the Erlang benchmarks you've been sitting on, go ahead and submit them. I submitted a new sieve. (The code is there, but the execution time doesn't reflect it yet.) From chandrashekhar.mullaparthi@REDACTED Fri Jun 25 18:36:42 2004 From: chandrashekhar.mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Fri, 25 Jun 2004 17:36:42 +0100 Subject: SASL Question In-Reply-To: <8691AB32-C5F5-11D8-AF1E-000A956D87EE@patternmatched.com> References: <8691AB32-C5F5-11D8-AF1E-000A956D87EE@patternmatched.com> Message-ID: Don't know what's causing your behaviour, but this works for us. {sasl, [{error_logger_mf_dir, "/export/home/otpuser/esas/sasl_logfiles/"}, {error_logger_mf_maxbytes, 100000}, {error_logger_mf_maxfiles, 8}]}, It rotates around 8 files each of size ~100KB cheers Chandru On 24 Jun 2004, at 16:45, Rudolph van Graan wrote: > Hi All, > > Quick question... I've configured SASL like this: > > {sasl,[ > {sasl_error_logger,{file,"/var/log/erl/error.log"}} > > And like this > > {sasl,[ > {sasl_error_logger,{file,"/var/log/erl/error.log"}}, > {errlog_type,error} > > In both cases I get SASL to log me progress reports and supervisor > reports into the specified file. Things like this: > > =PROGRESS REPORT==== 24-Jun-2004::15:38:14 === > application: app > started_at: app@REDACTED > > The problem is this: I don't see any error reports or anything again > after startup, ever. It seems that SASL just stops recording error > reports and ignores the error reports. I am sure that a lot of error > reports occur, but for the life of me I cannot seem to convince SASL > to log them for me. Is there anything obvious I miss? > > While I'm at it... SASL also seems to delete the log file everytime > the erl VM is restarted. Why is this and how do I convince it not to > do this and to simply append to the current one? > > Regards, > > Rudolph van Graan From Marc.Vanwoerkom@REDACTED Fri Jun 25 18:58:52 2004 From: Marc.Vanwoerkom@REDACTED (Marc van Woerkom) Date: Fri, 25 Jun 2004 18:58:52 +0200 Subject: The Great Computer Language Shootout is back In-Reply-To: Message-ID: Am Fri, 25 Jun 2004 09:01:25 -0500 hat James Hague geschrieben: >Someone else picked it up: > >http://shootout.alioth.debian.org/ > >If there are changes to the Erlang benchmarks you've been >sitting on, go >ahead and submit them. I submitted a new sieve. (The >code is there, but >the execution time doesn't reflect it yet.) Hm there is an array access test: http://shootout.alioth.debian.org/bench/ary/ it is implemented via ets. I should try that hint Ulf Wigner gave me, when I asked how to implement an array to store the ICFP ants on a game board. Regards, Marc From thomasl_erlang@REDACTED Fri Jun 25 19:10:03 2004 From: thomasl_erlang@REDACTED (Thomas Lindgren) Date: Fri, 25 Jun 2004 10:10:03 -0700 (PDT) Subject: Did Erlang borrow from Ada? In-Reply-To: Message-ID: <20040625171003.78423.qmail@web41901.mail.yahoo.com> --- Tony Rogvall wrote: > Do not get me wrong, I like Prolog. But to use it > you must learn > programming from > scratch or put in a lot of cuts :-) Over the years, I developed a way of writing "non-searching" Prolog that didn't rely on (explicit) cuts and yielded clear procedural code. I always thought it could have been a good stepping stone for the hacker that wanted to get rolling. But at the time, Prolog had already imploded so there didn't seem to be much of an audience for such a thing. Oh well :-/ Best, Thomas __________________________________ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail From vances@REDACTED Fri Jun 25 19:18:01 2004 From: vances@REDACTED (Vance Shipley) Date: Fri, 25 Jun 2004 13:18:01 -0400 Subject: SASL Question In-Reply-To: References: <8691AB32-C5F5-11D8-AF1E-000A956D87EE@patternmatched.com> Message-ID: <20040625171801.GB89134@frogman.motivity.ca> Chandru, Yes, that method does indeed log the error_reports and it doesn't overwrite each time it starts. It is however not the same thing as it creates binary files which you then use the report browser to read. I actually use both methods, the run_erl logs of the tty output in text format and the log_mf_h for use with the report browser. The former captures shell interaction and io output and is easy to grep through. The later has the advantage of collecting the reports you are interested in and formatting them for you. -Vance On Fri, Jun 25, 2004 at 05:36:42PM +0100, Chandrashekhar Mullaparthi wrote: } Don't know what's causing your behaviour, but this works for us. } } {sasl, [{error_logger_mf_dir, } "/export/home/otpuser/esas/sasl_logfiles/"}, } {error_logger_mf_maxbytes, 100000}, } {error_logger_mf_maxfiles, 8}]}, } } It rotates around 8 files each of size ~100KB } } cheers } Chandru From vances@REDACTED Fri Jun 25 19:27:56 2004 From: vances@REDACTED (Vance Shipley) Date: Fri, 25 Jun 2004 13:27:56 -0400 Subject: The Great Computer Language Shootout is back In-Reply-To: References: Message-ID: <20040625172756.GC89134@frogman.motivity.ca> I didn't like the exception implementation so I rewrote it. It had been using the process dictionary and was doing throws. I rewrote it to handle real exceptions and not use the process dictionary. I managed to slow it down. :) -Vance $ time erl -noinput -s except main 200000 Exceptions: HI=100000 / LO=100000 real 0m0.927s user 0m0.650s sys 0m0.150s $ time erl -noinput -run except2 main 200000 Calling: 100000, Caller: 100000 real 0m0.994s user 0m0.730s sys 0m0.140s -------------- next part -------------- %% The Great Computer Language Shootout %% contributed by Isaac Gouy (Erlang novice) %% %% http://shootout.alioth.debian.org/ %% %% Used destructive assignment in the process dictionary %% to keep count of handled exceptions. %% %% Usage: start from command line with %% erlc except.erl %% erl -noinput -s except main 200000 -module(except). -export([main/1]). blowup(N) when N rem 2 == 0 -> throw({lo_exception, N}); blowup(N) -> throw({hi_exception, N}). lo_fun(N) -> case catch blowup(N) of {lo_exception, N1} -> put(lo_count, get(lo_count) + 1); {hi_exception, N2} -> throw({hi_exception, N2}) end. hi_fun(N) -> case catch lo_fun(N) of {hi_exception, N1} -> put(hi_count, get(hi_count) + 1); _ -> true end. some_fun(0) -> true; some_fun(N) -> case catch hi_fun(N) of {lo_exception, N1} -> io:fwrite("~s~n", ["lo_exception should not get here."]); {hi_exception, N2} -> io:fwrite("~s~n", ["hi_exception should not get here."]); _ -> true end, some_fun(N - 1). main([Arg]) -> Num = list_to_integer(atom_to_list(Arg)), put(hi_count, 0), put(lo_count, 0), some_fun(Num), io:fwrite("~s~w ~s~w~n", ["Exceptions: HI=", get(hi_count),"/ LO=", get(lo_count)]), halt(0). -------------- next part -------------- %% The Great Computer Language Shootout %% contributed by Vance Shipley %% %% http://shootout.alioth.debian.org/ %% %% Usage: start from command line with %% erlc except.erl %% erl -noinput -run except main 200000 -module(except2). -export([main/1]). main([Arg]) -> N = list_to_integer(Arg), {Calling, Caller} = loop(N, 0, 0), io:fwrite("Calling: ~w, Caller: ~w~n", [Calling, Caller]), halt(0). loop(0, Calling, Caller) -> {Calling, Caller}; loop(N, Calling, Caller) -> case catch call(N, Calling) of {'EXIT', _Reason} -> %% handled exception here loop(N - 1, Calling, Caller + 1); X -> %% calling function handled exception loop(N - 1, X, Caller) end. call(N, Calling) -> %% when do/1 returns ok exits with badmatch case catch do(N) of {'EXIT', _Reason} -> Calling + 1 end. %% calling with an odd value exits with badarg do(N) when N rem 2 == 0 -> ok. From mscandar@REDACTED Fri Jun 25 20:34:31 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Fri, 25 Jun 2004 14:34:31 -0400 Subject: ets:fun2ms question Message-ID: <40DC7037.5080007@cisco.com> After much perusal of the manuals, I still can't figure this out... I have some fairly complex match funs that I'm using to do wildcarded searches on non-key fields, and sometimes I just want them to return true (when using ets:select_delete/2) and sometimes I want them to return the object (when using ets:select/2). Is there a way to parameterize the return of the fun or do I have to just have two identical match funs (except for the return)? Thanks, Mark. From joe@REDACTED Fri Jun 25 21:43:18 2004 From: joe@REDACTED (Joe Armstrong) Date: Fri, 25 Jun 2004 21:43:18 +0200 (CEST) Subject: escript works - !! yes Message-ID: Oh happy day I found to my *amazement* that escript etc all seems to get build automatically in the R9C-2 build and everything works nicely. Thanks guys great work. This seems to be sparsely documented so I've appended some information to get you started at the end of this mail. Personally I very much like Erlang scripts, ideal for automating lots of trivial tasks. Questions: 1) Is the fact that this works a happy coincidence - I haven't dared test the other stuff elink etc. 2) Does the fact that this still work mean that stand-alone Erlang is still on the agenda? Cheers /Joe If you want to try this at home do like this: 1) Build R9C-2 2) Put a couple of symlinks so that escript and beam_evm can be found On my home machine I did this: $ cd ~/bin $ ln -s /home/joe/installed/otp_src_R9C-2/erts/boot/src/escript $ ln -s /home/joe/installed/otp_src_R9C-2/bin/i686-pc-linux-gnu/beam_evm (~/bin is in my path and ~joe/installed/... is where I built R9C) After this erlang scripting sprang into life: Here are two example scripts --- fib1 --- #!/usr/bin/env escript -export([main/1]). main([X]) -> J = list_to_integer(X), N = fib(J), io:format("fib ~w = ~w~n",[J, N]). fib(0) -> 0; fib(1) -> 1; fib(N) -> fib(N-1) + fib(N-2). --- fib2 ---- #!/usr/bin/env escript -export([main/1]). -mode(compile). main([X]) -> J = list_to_integer(X), N = fib(J), io:format("fib ~w = ~w~n",[J, N]). fib(0) -> 0; fib(1) -> 1; fib(N) -> fib(N-1) + fib(N-2). Just chmod them to executable and off you go. -------------------- The timings are reasonably ok $ ./fib1 1 (0.06 sec) $ ./fib2 1 (0.16 sec) $ ./fib1 25 (3.06 sec) $ ./fib2 25 (0.19 sec) fib2 has a compile annotation, so for lengthy calculations it is better to incur the 0.14 sec compilation overhead. From joe@REDACTED Fri Jun 25 21:46:56 2004 From: joe@REDACTED (Joe Armstrong) Date: Fri, 25 Jun 2004 21:46:56 +0200 (CEST) Subject: SAE doesn't work Message-ID: I tried (and failed) to ressurect my old Stand alone Erlang (SAE) with R9C-2 ... Oh sad day (and rainy to boot - this is probably the worse summer I can remember - it just rains all the time :<() I ran into a weird problem my system couldn't find erlang:open_port/2 - now there *used* to be a module erl_open_port.erl and some yuck in erlang.erl that did the deed. What has happened to all of this? Also I note the appearence of erlang:blocking_read_file/1 is this now here to stay? ((don't even think about calling this unless you are writing a low-level boot loader for Erlang itself ...)) <> IMHO the Erlang start-up procedure is getting more and more complex. A simpler method goes something like this. - O - ((thinking out loud)) Make a tuple {Mod, Func, Args, [{Mod,Code}}] [{Mod,Code}] is a list of {Module, CompiledObjectCode} tuples store this in a file. "boot.img" To start the system. Run the (precompiled) code in ring0.erl (this might define run() as ...) run() -> Bin = erlang:blocking_read_file("boot.img"), T = binary_to_term(Bin), cold_start(T). cold_start({Mod, Func, Args, Mods}) -> load_mods(Mods), (catch apply(Mod, Func, Args)), erlag:halt(). load_mods([{Mod,Code}|T]) -> case erlang:load_module(Mod, Code) of {module,Mod} -> [Mod|load_mods(T)]; Other -> %% erlang:display({bad_module,Mod}), erlang:halt(-1) end; load_mods([]) -> []. IMHO the start-up procedure can be greatly simplified if we assume the following: There are certain BIFs (like blocking_read_file/1, get_env/1 ... that are *only* to be used when booting the system and *before* normal user-level processes are run. These bifs should allow the user to write erlang code to set up all emulator flags etc. ((all the "funny" flags to Erlang)) When the system is "up and running" all I/O etc will be non-blocking but getting there can use blocking calls etc. Cheers /Joe From mscandar@REDACTED Fri Jun 25 22:38:04 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Fri, 25 Jun 2004 16:38:04 -0400 Subject: escript works - !! yes References: Message-ID: <40DC8D2C.2060009@cisco.com> Is ~joe/installed/... on your path too? When I installed it, beam_evm wasn't moved from the build directory and ERLANG_EARS was pointing to the build directory, too. (This didn't work out too well for me: I built it in a solaris /tmp filesystem). I had to manually copy beam_evm and mung the beginning of ecc/elink/escript/ear with the correct path. Once I did that everything worked. Mark. Joe Armstrong wrote: > Oh happy day > > I found to my *amazement* that escript etc all seems to get build > automatically in the R9C-2 build and everything works nicely. Thanks guys > great work. > > This seems to be sparsely documented so I've appended some > information to get you started at the end of this mail. > > Personally I very much like Erlang scripts, ideal for automating > lots of trivial tasks. > > Questions: > > 1) Is the fact that this works a happy coincidence - I haven't dared > test the other stuff elink etc. > > 2) Does the fact that this still work mean that stand-alone Erlang > is still on the agenda? > > Cheers > > /Joe > > If you want to try this at home do like this: > > 1) Build R9C-2 > > 2) Put a couple of symlinks so that escript and beam_evm can be found > > On my home machine I did this: > > $ cd ~/bin > $ ln -s /home/joe/installed/otp_src_R9C-2/erts/boot/src/escript > $ ln -s /home/joe/installed/otp_src_R9C-2/bin/i686-pc-linux-gnu/beam_evm > > (~/bin is in my path and ~joe/installed/... is where I built R9C) > > After this erlang scripting sprang into life: > > Here are two example scripts > > --- fib1 --- > > #!/usr/bin/env escript > > -export([main/1]). > > main([X]) -> > J = list_to_integer(X), > N = fib(J), > io:format("fib ~w = ~w~n",[J, N]). > > fib(0) -> 0; > fib(1) -> 1; > fib(N) -> > fib(N-1) + fib(N-2). > > --- fib2 ---- > #!/usr/bin/env escript > > -export([main/1]). > > -mode(compile). > > main([X]) -> > J = list_to_integer(X), > N = fib(J), > io:format("fib ~w = ~w~n",[J, N]). > > fib(0) -> 0; > fib(1) -> 1; > fib(N) -> > fib(N-1) + fib(N-2). > > > Just chmod them to executable and off you go. > > -------------------- > > The timings are reasonably ok > > $ ./fib1 1 (0.06 sec) > $ ./fib2 1 (0.16 sec) > $ ./fib1 25 (3.06 sec) > $ ./fib2 25 (0.19 sec) > > fib2 has a compile annotation, so for lengthy calculations it is better > to incur the 0.14 sec compilation overhead. > > From mscandar@REDACTED Fri Jun 25 22:40:26 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Fri, 25 Jun 2004 16:40:26 -0400 Subject: escript works - !! yes References: <40DC8D2C.2060009@cisco.com> Message-ID: <40DC8DBA.40805@cisco.com> (Doh! I didn't read the part where you added symlinks...) Mark Scandariato wrote: > Is ~joe/installed/... on your path too? > > When I installed it, beam_evm wasn't moved from the build directory and > ERLANG_EARS was pointing to the build directory, too. (This didn't work > out too well for me: I built it in a solaris /tmp filesystem). > > I had to manually copy beam_evm and mung the beginning of > ecc/elink/escript/ear with the correct path. > > Once I did that everything worked. > > Mark. > > Joe Armstrong wrote: > >> Oh happy day >> >> I found to my *amazement* that escript etc all seems to get build >> automatically in the R9C-2 build and everything works nicely. Thanks guys >> great work. >> >> This seems to be sparsely documented so I've appended some >> information to get you started at the end of this mail. >> >> Personally I very much like Erlang scripts, ideal for automating >> lots of trivial tasks. >> >> Questions: >> >> 1) Is the fact that this works a happy coincidence - I haven't dared >> test the other stuff elink etc. >> >> 2) Does the fact that this still work mean that stand-alone Erlang >> is still on the agenda? >> >> Cheers >> >> /Joe >> >> If you want to try this at home do like this: >> >> 1) Build R9C-2 >> >> 2) Put a couple of symlinks so that escript and beam_evm can be found >> >> On my home machine I did this: >> >> $ cd ~/bin >> $ ln -s /home/joe/installed/otp_src_R9C-2/erts/boot/src/escript >> $ ln -s >> /home/joe/installed/otp_src_R9C-2/bin/i686-pc-linux-gnu/beam_evm >> >> (~/bin is in my path and ~joe/installed/... is where I built R9C) >> >> After this erlang scripting sprang into life: >> >> Here are two example scripts >> >> --- fib1 --- >> >> #!/usr/bin/env escript >> >> -export([main/1]). >> >> main([X]) -> >> J = list_to_integer(X), >> N = fib(J), >> io:format("fib ~w = ~w~n",[J, N]). >> >> fib(0) -> 0; >> fib(1) -> 1; >> fib(N) -> >> fib(N-1) + fib(N-2). >> >> --- fib2 ---- >> #!/usr/bin/env escript >> >> -export([main/1]). >> >> -mode(compile). >> >> main([X]) -> >> J = list_to_integer(X), >> N = fib(J), >> io:format("fib ~w = ~w~n",[J, N]). >> >> fib(0) -> 0; >> fib(1) -> 1; >> fib(N) -> >> fib(N-1) + fib(N-2). >> >> >> Just chmod them to executable and off you go. >> >> -------------------- >> >> The timings are reasonably ok >> >> $ ./fib1 1 (0.06 sec) >> $ ./fib2 1 (0.16 sec) >> $ ./fib1 25 (3.06 sec) >> $ ./fib2 25 (0.19 sec) >> >> fib2 has a compile annotation, so for lengthy calculations it is better >> to incur the 0.14 sec compilation overhead. >> >> > > From mickael.remond@REDACTED Sat Jun 26 16:32:07 2004 From: mickael.remond@REDACTED (=?iso-8859-15?Q?Micka=EBl_R=E9mond?=) Date: Sat, 26 Jun 2004 14:32:07 -0000 Subject: The Great Computer Language Shootout is back In-Reply-To: References: Message-ID: On Fri, 25 Jun 2004 18:58:52 +0200, Marc van Woerkom wrote: > Am Fri, 25 Jun 2004 09:01:25 -0500 hat > James Hague geschrieben: >> Someone else picked it up: >> >> http://shootout.alioth.debian.org/ >> >> If there are changes to the Erlang benchmarks you've been sitting on, go >> ahead and submit them. I submitted a new sieve. (The code is there, >> but >> the execution time doesn't reflect it yet.) > > Hm there is an array access test: > > http://shootout.alioth.debian.org/bench/ary/ > > it is implemented via ets. I should try that hint Ulf Wigner gave me, > when I asked how to implement an array to store the ICFP ants on a game > board. If I remember well, Shoutout benchmark did not use native compilation. This is something that could improve the performance. However, the time where mesure including startup time of the erl environment with the standard boot file. Using escript could speed thing (to avoid the complete environment startup penalty: In real life application you only start it once). I hope this helps, -- Micka?l R?mond http://www.erlang-projects.org/ From olgeni@REDACTED Sat Jun 26 22:41:19 2004 From: olgeni@REDACTED (Jimmy Olgeni) Date: Sat, 26 Jun 2004 22:41:19 +0200 (CEST) Subject: escript works - !! yes In-Reply-To: <40DC8D2C.2060009@cisco.com> References: <40DC8D2C.2060009@cisco.com> Message-ID: <20040626223447.F39233@olgeni.olgeni> Hi, On Fri, 25 Jun 2004, Mark Scandariato wrote: > When I installed it, beam_evm wasn't moved from the build directory and > ERLANG_EARS was pointing to the build directory, too. (This didn't work out > too well for me: I built it in a solaris /tmp filesystem). The attached patches should fix the installation issue, but I still had to edit the scripts and change ERLANG_EARS... The install script should do something like this, with LOCALBASE being the install prefix and ERTS_VSN the runtime version number: for SCRIPT in ecc elink ear escript; do sed -i "" -e "s@REDACTED=.*@ERLANG_EARS=${LOCALBASE}/lib/erlang/erts-${ERTS_VSN}@" ${LOCALBASE}/bin/${SCRIPT}; done for SCRIPT in ecc elink; do sed -i "" -e "s@REDACTED .*beam_evm@REDACTED beam_evm@" ${LOCALBASE}/bin/${SCRIPT}; done beam_evm just needs to be in $PATH, so the generated path may be removed, but ERLANG_EARS requires patching and I couldn't figure out how to do this in the OTP makefile... -- jimmy -------------- next part -------------- $FreeBSD$ --- erts/emulator/Makefile.in.orig Sat Jun 26 13:57:01 2004 +++ erts/emulator/Makefile.in Sat Jun 26 13:57:39 2004 @@ -220,6 +220,7 @@ $(INSTALL_DATA) $(RELEASE_INCLUDES) $(RELSYSDIR)/src $(INSTALL_PROGRAM) $(BINDIR)/$(EMULATOR_EXECUTABLE) $(RELSYSDIR)/bin ifeq ($(ERLANG_OSTYPE), unix) + $(INSTALL_PROGRAM) $(BINDIR)/$(EMULATOR_EXECUTABLE_SAE) $(RELSYSDIR)/bin $(INSTALL_PROGRAM) $(BINDIR)/$(EMULATOR_EXECUTABLE_ELIB) $(RELSYSDIR)/bin $(INSTALL_PROGRAM) $(BINDIR)/$(CS_EXECUTABLE) $(RELSYSDIR)/bin endif -------------- next part -------------- $FreeBSD$ --- Makefile.in.orig Fri Dec 19 13:55:58 2003 +++ Makefile.in Sat Jun 26 20:25:23 2004 @@ -534,14 +534,20 @@ # Erlang base public files # install.bin: - rm -f $(BINDIR)/erl $(BINDIR)/erlc \ - $(BINDIR)/ecc $(BINDIR)/elink $(BINDIR)/ear $(BINDIR)/escript + rm -f $(BINDIR)/erl $(BINDIR)/erlc $(BINDIR)/run_erl \ + $(BINDIR)/to_erl $(BINDIR)/beam_evm $(BINDIR)/ear \ + $(BINDIR)/ecc $(BINDIR)/elink $(BINDIR)/erlexec \ + $(BINDIR)/escript ${LN_S} $(ERLANG_BINDIR)/erl $(BINDIR)/erl ${LN_S} $(ERLANG_BINDIR)/erlc $(BINDIR)/erlc - ${LN_S} $(ERLANG_BINDIR)/ecc $(BINDIR)/ecc - ${LN_S} $(ERLANG_BINDIR)/elink $(BINDIR)/elink - ${LN_S} $(ERLANG_BINDIR)/ear $(BINDIR)/ear - ${LN_S} $(ERLANG_BINDIR)/escript $(BINDIR)/escript + ${LN_S} $(ERLANG_BINDIR)/run_erl $(BINDIR)/run_erl + ${LN_S} $(ERLANG_BINDIR)/to_erl $(BINDIR)/to_erl + ${LN_S} $(ERLANG_ERTSBINDIR)/beam_evm $(BINDIR)/beam_evm + ${LN_S} $(ERLANG_ERTSBINDIR)/ear $(BINDIR)/ear + ${LN_S} $(ERLANG_ERTSBINDIR)/ecc $(BINDIR)/ecc + ${LN_S} $(ERLANG_ERTSBINDIR)/elink $(BINDIR)/elink + ${LN_S} $(ERLANG_ERTSBINDIR)/erlexec $(BINDIR)/erlexec + ${LN_S} $(ERLANG_ERTSBINDIR)/escript $(BINDIR)/escript # # Directories needed before we can install From erlq@REDACTED Mon Jun 28 01:10:20 2004 From: erlq@REDACTED (Rob) Date: Sun, 27 Jun 2004 16:10:20 -0700 Subject: set sname after startup? Message-ID: <40DF53DC.3060108@itsbeen.sent.com> Hi, I am working on a system where I would like to have the nodes get their name and cookie info from their environment and a config file. Is there any way to set the name/sname parameters from inside a running erlang process? Thanks for any help. From bengt.kleberg@REDACTED Mon Jun 28 10:07:41 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 28 Jun 2004 10:07:41 +0200 Subject: set sname after startup? In-Reply-To: <40DF53DC.3060108@itsbeen.sent.com> References: <40DF53DC.3060108@itsbeen.sent.com> Message-ID: <40DFD1CD.7090309@ericsson.com> Rob wrote: > Hi, > > I am working on a system where I would like to have the nodes get > their name and cookie info from their environment and a config file. > > Is there any way to set the name/sname parameters from inside a > running erlang process? with the help of the module index with search (http://www.corelatus.com/~matthias/modules.html) it is possible to find that module net_kernel handles what you want. this it the relevant paragraf: This is done by the system itself, but the |start([Name])| function can also be called directly from the normal Erlang shell prompt, and a normal Erlang runtime system is then converted to a node. The kernel can be shut down with the function |stop()|, but only if the kernel was not started by the system itself. The node is then converted into a normal Erlang runtime system. All other nodes on the network will regard this as a total node crash. bengt From bengt.kleberg@REDACTED Mon Jun 28 13:38:36 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Mon, 28 Jun 2004 13:38:36 +0200 Subject: The Great Computer Language Shootout is back In-Reply-To: References: Message-ID: <40E0033C.7090107@ericsson.com> >> Am Fri, 25 Jun 2004 09:01:25 -0500 hat >> James Hague geschrieben: >> >>> Someone else picked it up: >>> >>> http://shootout.alioth.debian.org/ >>> >>> If there are changes to the Erlang benchmarks you've been sitting >>> on, go >>> ahead and submit them. >> i have sent a wc.erl (see below). it is really simple, but perhaps something faster is avaliable? many years ago i re-wrote all the benchmarks that used erlang:open_port() to use the io module for their io. due to bad timing they where done after the shootout moved to windows. for some reason the io module will not work with redirected stdin on windows. so all the my benchmarks failed to run. some time after that i changed jobs and lost track of them. they where very simple and i will re-create them, as i have with wc.erl, when times permits. perhaps they will work and be accepted for this shootout. bengt -module(wc). -export([main/0, main/1]). main() -> main(['1']). main(_Args) -> wc(io:get_line(''), 0, 0, 0), erlang:halt(0). wc(eof, Newlines, Words, Characters) -> io:format("~w ~w ~w~n", [Newlines, Words, Characters]); wc(Line, NL, NW, NC) -> Words = string:tokens(Line, " \t\n"), wc(io:get_line(''), NL + 1, NW + string:len(Words), NC + string:len(Line) ). From vances@REDACTED Mon Jun 28 21:24:44 2004 From: vances@REDACTED (Vance Shipley) Date: Mon, 28 Jun 2004 15:24:44 -0400 Subject: Shutting down a simple child Message-ID: <20040628192444.GC97686@frogman.motivity.ca> In the case of a simple_one_for_one supervisor you cannot use terminate_child/2. I'd like to use a simple supervisor and dynamically start child supervisors. The problem I am having is in shutting down those supervisors. In the case of a one_for_one supervisor you can use terminate_child/2 but that requires a child Id which is undefined in a simple supervisor. When I try to do exit(ChildSup, shutdown) it is just ignored. I've been looking at the supervisor.erl module but so far can't figure out what terminate_child/2 is doing differently. Ideally I'd like these dynamically added supervisors to be transient so that I can do an explicit shutdown but they would be restarted automatically if they terminated abnormally. Is this possible? -Vance From mscandar@REDACTED Tue Jun 29 01:18:27 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Mon, 28 Jun 2004 19:18:27 -0400 Subject: debugger & packages? Message-ID: <40E0A743.4040007@cisco.com> Is there a way to get the debugger to recognize packaged modules (e.g., -module(foo.bar.baz) in directory foo/bar)? It complains that the beam file foo/bar/baz.beam has the module name foo.bar.baz ! I couldn't find anything in the release notes (R9C-2). Thanks, Mark. From matthias@REDACTED Tue Jun 29 09:44:31 2004 From: matthias@REDACTED (Matthias Lang) Date: Tue, 29 Jun 2004 09:44:31 +0200 Subject: Erlang.NET In-Reply-To: <42E1A13A-C638-11D8-8F17-00039386EAAE@dominicwilliams.net> References: <42E1A13A-C638-11D8-8F17-00039386EAAE@dominicwilliams.net> Message-ID: <16609.7647.123830.421479@antilipe.corelatus.se> > Eric Newhuis wrote: > > Microsoft Research just announced this [Erlang.NET]. Dominic Williams wrote: > But it's hard to get excited about the idea... There seem to have been a bunch of projects to compile XYZ to .NET, and most of them seem to have stagnated about a year ago. For instance, I started wondering how much work it would be to use ETOS (http://www.iro.umontreal.ca/~etos/) and a Scheme->.NET compiler together. A quick search with Google found these scheme compilers: http://rover.cs.nwu.edu/~scheme/ http://radio.weblogs.com/0101156/stories/2002/03/19/tachy.html http://www.cs.indiana.edu/~jgrinbla/index.htm http://sourceforge.net/projects/luna-scheme/ All three of them have news items on the web page along the lines of "February 2003: released sort-of working code, only a few major features to go now". Maybe the devil is in the detail. Or maybe they all got hired by Microsoft Research and are now working on Excel macro toolkits. ;-) Five years ago, compiling various languages to the Java VM was all the rage, e.g. Kawa (http://www.gnu.org/software/kawa/) was born about then. Kawa seems to be moderately successful, it has a fairly lively mailing list, but it doesn't seem to have made Scheme any more popular. Matthias From bengt.kleberg@REDACTED Tue Jun 29 12:36:11 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 29 Jun 2004 12:36:11 +0200 Subject: is there a tolower() function? Message-ID: <40E1461B.7070101@ericsson.com> greetings, i have searched the documentation and the mail list. nowhere have i found tolower(). is there one? bengt From peter@REDACTED Tue Jun 29 12:45:26 2004 From: peter@REDACTED (Peter Lund) Date: Tue, 29 Jun 2004 12:45:26 +0200 (CEST) Subject: is there a tolower() function? In-Reply-To: <40E1461B.7070101@ericsson.com> References: <40E1461B.7070101@ericsson.com> Message-ID: <35144.193.15.249.14.1088505926.squirrel@www69.webcows.se> httpd_util:to_lower/1 > greetings, > > i have searched the documentation and the mail list. nowhere have i > found tolower(). is there one? > > > bengt > -- Peter Lund mobile: +46 70 543 9416 http://www.lundata.se From luke@REDACTED Tue Jun 29 12:51:20 2004 From: luke@REDACTED (Luke Gorrie) Date: Tue, 29 Jun 2004 12:51:20 +0200 Subject: Erlang.NET In-Reply-To: <16609.7647.123830.421479@antilipe.corelatus.se> (Matthias Lang's message of "Tue, 29 Jun 2004 09:44:31 +0200") References: <42E1A13A-C638-11D8-8F17-00039386EAAE@dominicwilliams.net> <16609.7647.123830.421479@antilipe.corelatus.se> Message-ID: Matthias Lang writes: > Five years ago, compiling various languages to the Java VM was all the > rage, e.g. Kawa (http://www.gnu.org/software/kawa/) was born about then. > Kawa seems to be moderately successful, it has a fairly lively mailing > list, but it doesn't seem to have made Scheme any more popular. Erlang tie-in: part of the Bluetail Mail Robustifier configuration GUI was written in Kawa, and some random testing code too. Great compiler :-) -Luke From bengt.kleberg@REDACTED Tue Jun 29 13:00:18 2004 From: bengt.kleberg@REDACTED (Bengt Kleberg) Date: Tue, 29 Jun 2004 13:00:18 +0200 Subject: is there a tolower() function? In-Reply-To: <35144.193.15.249.14.1088505926.squirrel@www69.webcows.se> References: <40E1461B.7070101@ericsson.com> <35144.193.15.249.14.1088505926.squirrel@www69.webcows.se> Message-ID: <40E14BC2.5090302@ericsson.com> Peter Lund wrote: >httpd_util:to_lower/1 > > > thank you. it was possible to find provided i searched for to_lower or lower-case. however, neither lowercase, nor tolower worked. something for the faq? bengt From bry@REDACTED Tue Jun 29 16:22:04 2004 From: bry@REDACTED (bry@REDACTED) Date: Tue, 29 Jun 2004 16:22:04 +0200 Subject: Erlang.NET In-Reply-To: <16609.7647.123830.421479@antilipe.corelatus.se> References: <42E1A13A-C638-11D8-8F17-00039386EAAE@dominicwilliams.net> <16609.7647.123830.421479@antilipe.corelatus.se> Message-ID: <1088518924.40e17b0c10f92@horde.scannet.dk> > > > But it's hard to get excited about the idea... > > There seem to have been a bunch of projects to compile XYZ to .NET, > and most of them seem to have stagnated about a year ago. > Frankly the idea of compiling Erlang to .NET does not appeal to me whatsoever. Would it be possible to do without jettisoning some of the benefits of Erlang? What does interest me would be the ability for Erlang to consume MSIL and interact with .NET code in that way. In other words the traffic should all be in the erlang direction. From davidw@REDACTED Tue Jun 29 18:02:41 2004 From: davidw@REDACTED (David N. Welton) Date: Tue, 29 Jun 2004 18:02:41 +0200 Subject: hd() vs [H|T] Message-ID: <40E192A1.7020005@eidetix.com> Hi, Someone who was kind enough to take a moment to critique my Hecl code mentioned that [H|_T] is faster than hd(). Is it that much faster that it warrants using a temporary variable where one might otherwise use foo(hd(Bar)) ? Thankyou, -- David N. Welton davidw@REDACTED From vances@REDACTED Tue Jun 29 18:28:20 2004 From: vances@REDACTED (Vance Shipley) Date: Tue, 29 Jun 2004 12:28:20 -0400 Subject: Shutting down a simple child In-Reply-To: <20040628192444.GC97686@frogman.motivity.ca> References: <20040628192444.GC97686@frogman.motivity.ca> Message-ID: <20040629162819.GE97686@frogman.motivity.ca> It seems that the main loop of gen_server (a supervisor is a gen_server) traps {'EXIT', Parent, Reason} and runs the terminate function. So to shutdown the child with the same method you would need to send an EXIT message with the pid of the supervisor. {ok, SuperSuper} = supervisor:start_link(supersuper, []), {ok, Super} = supervisor:start_child(SuperSuper, []), ... Super ! {'EXIT', SuperSuper, shutdown}. Hmmm ... is that bad form? -Vance From erlq@REDACTED Tue Jun 29 20:21:57 2004 From: erlq@REDACTED (Rob) Date: Tue, 29 Jun 2004 11:21:57 -0700 Subject: set sname after startup? In-Reply-To: <40DFD1CD.7090309@ericsson.com> References: <40DF53DC.3060108@itsbeen.sent.com> <40DFD1CD.7090309@ericsson.com> Message-ID: <40E1B345.3040500@itsbeen.sent.com> Bengt Kleberg wrote: > Rob wrote: >> Hi, >> >> I am working on a system where I would like to have the nodes get >> their name and cookie info from their environment and a config file. >> >> Is there any way to set the name/sname parameters from inside a >> running erlang process? > > with the help of the module index with search > (http://www.corelatus.com/~matthias/modules.html) it is possible to find > that module net_kernel handles what you want. this it the relevant > paragraf: > > This is done by the system itself, but the |start([Name])| function can > also be called directly from the normal Erlang shell prompt, and a > normal Erlang runtime system is then converted to a node. The kernel can > be shut down with the function |stop()|, but only if the kernel was not > started by the system itself. The node is then converted into a normal > Erlang runtime system. All other nodes on the network will regard this > as a total node crash. > > bengt Thanks, that does seem to be important, because when I tried doing: net_kernel:start([foo]). I got an error and if I tried set_cookie, I got an error. I had to have a cookie file created before I could run the net_kernel:start([foo]). command and then after that I could run set_cookie(node(), 'mycookie'). My next question whether there is a way to change the system to use IP address rather than hostname or FQDN. Rob From mscandar@REDACTED Wed Jun 30 00:24:09 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Tue, 29 Jun 2004 18:24:09 -0400 Subject: debugger & packages? References: <40E0A743.4040007@cisco.com> Message-ID: <40E1EC09.8000001@cisco.com> Here's the actual error: =ERROR REPORT==== 29-Jun-2004::18:19:04 === beam/beam_load.c(908): Error loading module foo: module name in object code is pkg.foo =ERROR REPORT==== 29-Jun-2004::18:19:04 === Loading of /users/mscandar/Test/src/pkg/foo.beam failed: badfile =ERROR REPORT==== 29-Jun-2004::18:19:04 === Error in process <0.215.0> with exit value: {{badmatch,{error,badfile}},[{int,'- load/2-fun-0-',2},{int,load,2},{dbg_ui_interpret,gui_cmd,2},{dbg_ui_interpret,lo op,1}]} Mark Scandariato wrote: > Is there a way to get the debugger to recognize packaged modules (e.g., > -module(foo.bar.baz) in directory foo/bar)? > > It complains that the beam file foo/bar/baz.beam has the module name > foo.bar.baz ! > > I couldn't find anything in the release notes (R9C-2). > > Thanks, > Mark. > From Jouni.Ryno@REDACTED Wed Jun 30 09:36:31 2004 From: Jouni.Ryno@REDACTED (Jouni =?ISO-8859-1?Q?Ryn=F6?=) Date: Wed, 30 Jun 2004 10:36:31 +0300 Subject: run_erl and ptys Message-ID: <1088580991.27890.8.camel@adic.fmi.fi> The run_erl program does not run with linux 2.6 with udev (Debian distro), as there are no /dev/ptyX etc files, only /dev/pts -filesystem. A small hack against the run_erl.c would help: 47a48,49 > #include > #include 753a756 > int sfd; 820a824,831 > { > static char ttyname[] = " "; > > if (0 == openpty(&mfd, &sfd, ttyname, NULL, NULL)) { > *ptyslave = ttyname; > return mfd; > } > } regards Jouni -- Jouni Ryn? mailto://Jouni.Ryno@REDACTED/ http://www.geo.fmi.fi/~ryno/ Finnish Meteorological Institute http://www.fmi.fi/ Space Research http://www.geo.fmi.fi/ P.O.BOX 503 Tel (+358)-9-19294656 FIN-00101 Helsinki FAX (+358)-9-19294603 Finland priv-GSM (+358)-50-5302903 "It's just zeros and ones, it cannot be hard" From carsten@REDACTED Wed Jun 30 11:14:31 2004 From: carsten@REDACTED (Carsten Schultz) Date: Wed, 30 Jun 2004 11:14:31 +0200 Subject: SSL accept Message-ID: <20040630091430.GG17389@penne.localnet> Hi, I just noticed that a problem I thought had gone away is still there. In November 2003, Alexey Shchepin reported (http://www.erlang.org/ml-archive/erlang-questions/200311/msg00173.html) | * ssl:accept locks when when one TCP connection is established, but | SSL handshake is not finished. E.g. if Yaws is listen for SSL | connections on port 443 and someone runs "telnet this.server 443" | (note that this is not SSL-enabled telnet), then noone will be | able to retreive web pages via this port until this connection | will be closed. Has anything happened in this regard? Greetings, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: From peter@REDACTED Wed Jun 30 21:16:55 2004 From: peter@REDACTED (Peter H|gfeldt) Date: Wed, 30 Jun 2004 21:16:55 +0200 (MET DST) Subject: SSL accept In-Reply-To: <20040630091430.GG17389@penne.localnet> Message-ID: ------------------------------------------------------------------------- Peter H?gfeldt e-mail : peter@REDACTED Open Telecom Platform Phone: : +46 (8) 727 57 58 Ericsson Utvecklings AB Mobile : +46 070-519 57 51 S-126 25 STOCKHOLM Fax: : +46 (8) 727 5775 Office address: Armborstv?gen 1, ?lvsj? "Computers are machines that do exactly what you tell them, but often surprise you in the result." Richard Dawkins in The Blind Watchmaker On Wed, 30 Jun 2004, Carsten Schultz wrote: > Hi, > > I just noticed that a problem I thought had gone away is still there. > In November 2003, Alexey Shchepin reported > (http://www.erlang.org/ml-archive/erlang-questions/200311/msg00173.html) > > | * ssl:accept locks when when one TCP connection is established, but > | SSL handshake is not finished. E.g. if Yaws is listen for SSL > | connections on port 443 and someone runs "telnet this.server 443" > | (note that this is not SSL-enabled telnet), then noone will be > | able to retreive web pages via this port until this connection > | will be closed. > > Has anything happened in this regard? In Nov 3, 2003 in response to Alexey's question I wrote: In Erlang/OTP SSL you can have several processes, each waiting for an ssl:accept/N on one and the the same port. That is needed to obtain acceptable (no pun intended) parallellism. That it not practically possible with gen_tcp:accept/N (if you try it you will get an error return). I think gen_tcp should accept multiple accepts as well. That is, if you have the very simple approach with only one process calling ssl:accept/1 in series, you will get the behaviour described. What you should do is to have several processes in parallel waiting for the result of calling ssl:accept/1 (and spawning a new process when a return is obtained). Also, to avoid an indefinite wait for an accept call, and thus avoid that a file descriptor will never be returned, you should use ssl:accept/2 with timeout. /Peter > Greetings, > > Carsten > > -- > Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin > http://carsten.codimi.de/ > PGP/GPG key on the pgp.net key servers, > fingerprint on my home page. > -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: URL: From mscandar@REDACTED Wed Jun 30 23:28:05 2004 From: mscandar@REDACTED (Mark Scandariato) Date: Wed, 30 Jun 2004 17:28:05 -0400 Subject: Matching binaries in list comprehensions Message-ID: <40E33065.3010105@cisco.com> Given a list of binaries in Recs, I have the following list comprehension: Msgs = (catch [{Type, Value} || <> <- Recs]) The compiler complains: Warning: variable '_Len' shadowed in generate But the code works fine. _Len appears nowhere else in the function. What's the warning mean? Thanks, Mark. From carsten@REDACTED Wed Jun 30 23:44:30 2004 From: carsten@REDACTED (Carsten Schultz) Date: Wed, 30 Jun 2004 23:44:30 +0200 Subject: SSL accept In-Reply-To: References: <20040630091430.GG17389@penne.localnet> Message-ID: <20040630214429.GA697@penne.localnet> Hi, Peter! On Wed, Jun 30, 2004 at 09:16:55PM +0200, Peter H|gfeldt wrote: > On Wed, 30 Jun 2004, Carsten Schultz wrote: > > I just noticed that a problem I thought had gone away is still there. > > In November 2003, Alexey Shchepin reported > > (http://www.erlang.org/ml-archive/erlang-questions/200311/msg00173.html) > > > > | * ssl:accept locks when when one TCP connection is established, but > > | SSL handshake is not finished. E.g. if Yaws is listen for SSL > > | connections on port 443 and someone runs "telnet this.server 443" > > | (note that this is not SSL-enabled telnet), then noone will be > > | able to retreive web pages via this port until this connection > > | will be closed. > > > > Has anything happened in this regard? > > In Nov 3, 2003 in response to Alexey's question I wrote: > > In Erlang/OTP SSL you can have several processes, each waiting for > an ssl:accept/N on one and the the same port. That is needed to > obtain acceptable (no pun intended) parallellism. > > That it not practically possible with gen_tcp:accept/N (if you try > it you will get an error return). I think gen_tcp should accept > multiple accepts as well. > > That is, if you have the very simple approach with only one process > calling ssl:accept/1 in series, you will get the behaviour described. > > What you should do is to have several processes in parallel waiting for > the result of calling ssl:accept/1 (and spawning a new process when a > return is obtained). > > Also, to avoid an indefinite wait for an accept call, and thus avoid > that a file descriptor will never be returned, you should use > ssl:accept/2 with timeout. Back then you also wrote :-) | I also agree that there should be some kind of "pre_accept" that | returns a "raw" non-SSL socket, to be closed on reasons you have | mentioned I really do think that this is the way to go. Your solution above does not convince me. How many accepts should I run in parallel? What should the timeout be? Why this is a problem even without malicious client processes is that it is not unusual to have *user* *interaction* on the client side in the course of the SSL connect. To avoid not being able to accept new connections I would need to have as many parallel accepts as users simultaneously looking at certificates and pondering whether to trust them. I would not know how to obtain a reasonable upper bound on that. Nevertheless, your answer pointed me in a direction to partly fix the problem. Thanks, Carsten -- Carsten Schultz (2:38, 33:47), FB Mathematik, FU Berlin http://carsten.codimi.de/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page.